summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-21 18:52:58 +0000
committertkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-21 18:52:58 +0000
commit6b65b44e9d3f33a55101733132f5b3aca6500d21 (patch)
treed2feca75137109dcc3c7499ef05fa489724d21c9
parentae24e3da93558685a53af612edd552c55ba72f50 (diff)
downloadgcc-6b65b44e9d3f33a55101733132f5b3aca6500d21.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@214281 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/fortran/ChangeLog7
-rw-r--r--gcc/fortran/frontend-passes.c4
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/gfortran.dg/array_assignment_5.f9016
4 files changed, 33 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 91330ffdd5f..fcb4a7bb698 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -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
diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c
index edf63486784..23a8ece17ee 100644
--- a/gcc/fortran/frontend-passes.c
+++ b/gcc/fortran/frontend-passes.c
@@ -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))
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 222da32c1e2..53fed571851 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 00000000000..6d585270cea
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/array_assignment_5.f90
@@ -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