]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/62214 (Problem with spread plus concatenation for characters)
authorThomas Koenig <tkoenig@gcc.gnu.org>
Thu, 21 Aug 2014 18:52:58 +0000 (18:52 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Thu, 21 Aug 2014 18:52:58 +0000 (18:52 +0000)
2014-08-21  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/62214
* frontend-passes.c (optimize_binop_array_assignment):
Do not try to optimize the array assignment for string
concatenation.

2014-08-21  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/62214
* gfortran.dg/array_assignment_5.f90:  New test.

From-SVN: r214281

gcc/fortran/ChangeLog
gcc/fortran/frontend-passes.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/array_assignment_5.f90 [new file with mode: 0644]

index 91330ffdd5f7adaf1ce2088d7611773c90517baa..fcb4a7bb6980506c91969156fff3956fc422da8b 100644 (file)
@@ -1,3 +1,10 @@
+2014-08-21  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/62214
+       * frontend-passes.c (optimize_binop_array_assignment):
+       Do not try to optimize the array assignment for string
+       concatenation.
+
 2014-08-21  Manuel López-Ibáñez  <manu@gcc.gnu.org>
 
        PR fortran/44054
index edf63486784e19e9753e35b1075817ea0c5e5965..23a8ece17ee8b99240343caac5b4e3f523c56e14 100644 (file)
@@ -903,6 +903,10 @@ optimize_binop_array_assignment (gfc_code *c, gfc_expr **rhs, bool seen_op)
            return true;
          break;
 
+       case INTRINSIC_CONCAT:
+         /* Do not do string concatenations.  */
+         break;
+
        default:
          /* Binary operators.  */
          if (optimize_binop_array_assignment (c, &e->value.op.op1, true))
index 222da32c1e275bd1d7b34b00ff580e2fa85dd873..53fed571851c698be7ed52476936e9ff401c5c7d 100644 (file)
@@ -1,3 +1,8 @@
+2014-08-21  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/62214
+       * gfortran.dg/array_assignment_5.f90:  New test.
+
 2014-08-21  Sandra Loosemore  <sandra@codesourcery.com>
 
        * lib/target-supports.exp
@@ -9,7 +14,7 @@
        * gcc.dg/tree-ssa/interposition.c: Require fpic effective target
        for test using -fPIC.
        * gcc.dg/lto/pr61526_0.c: Likewise.
-       
+
 2014-08-21  Jan Hubicka  <hubicka@ucw.cz>
 
        PR tree-optimization/62091
diff --git a/gcc/testsuite/gfortran.dg/array_assignment_5.f90 b/gcc/testsuite/gfortran.dg/array_assignment_5.f90
new file mode 100644 (file)
index 0000000..6d58527
--- /dev/null
@@ -0,0 +1,16 @@
+! { dg-do run }
+! { dg-options "-ffrontend-optimize" }
+! PR 62214 - this used to give the wrong result.
+! Original test case by Oliver Fuhrer
+PROGRAM test
+  IMPLICIT NONE
+  CHARACTER(LEN=20)   :: fullNames(2)
+  CHARACTER(LEN=255)  :: pathName
+  CHARACTER(LEN=5)    :: fileNames(2)
+  
+  pathName = "/dir1/dir2/"
+  fileNames = (/ "file1", "file2" /)
+  fullNames = SPREAD(TRIM(pathName),1,2) // fileNames
+  if (fullNames(1) /= '/dir1/dir2/file1' .or. &
+       & fullnames(2) /= '/dir1/dir2/file2') call abort
+END PROGRAM test