This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch, fortran, committed] Fix PR 62214


Hello world,

the attached patch fixes the PR.  Committed to trunk as obvious after
regression-testing.  Will commit to 4.9 and 4.8 after regression
testing there.

Any idea why rather so many rather old bugs are coming up all of a
sudden?  Did a major distribution just upgrade its gcc version?

Regards

	Thomas

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.
Index: frontend-passes.c
===================================================================
--- frontend-passes.c	(Revision 214061)
+++ frontend-passes.c	(Arbeitskopie)
@@ -903,6 +903,10 @@ optimize_binop_array_assignment (gfc_code *c, gfc_
 	    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))
! { 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]