]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/68147 (Potential incorrect code generation for string self-assignment)
authorThomas Koenig <tkoenig@gcc.gnu.org>
Sun, 28 Feb 2016 22:27:55 +0000 (22:27 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Sun, 28 Feb 2016 22:27:55 +0000 (22:27 +0000)
2016-02-28  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/68147
PR fortran/47674
* frontend-passes.c (realloc_string_callback): Don't set
walk_subtrees.

2016-02-28  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/68147
PR fortran/47674
* gfortran.dg/realloc_on_assign_26.f90:  New test case.

From-SVN: r233797

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

index 9d2c94bc2bf1bf08d6871dbbc3c5ba6a0ff6fcf2..54950beffd2a27dc5cc0cd8645f34fda41868279 100644 (file)
@@ -1,3 +1,10 @@
+2016-02-28  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/68147
+       PR fortran/47674
+       * frontend-passes.c (realloc_string_callback): Don't set
+       walk_subtrees.
+
 2016-02-28  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        * dump-parse-tree.c (show_code_node):  Print association
index 156ea2b764020c79f7b526987267a6e2b953a370..7eeb5a68aa2bdf54b2eaf7d0916f995e344565ac 100644 (file)
@@ -153,14 +153,13 @@ gfc_run_passes (gfc_namespace *ns)
  */
 
 static int
-realloc_string_callback (gfc_code **c, int *walk_subtrees,
+realloc_string_callback (gfc_code **c, int *walk_subtrees ATTRIBUTE_UNUSED,
                         void *data ATTRIBUTE_UNUSED)
 {
   gfc_expr *expr1, *expr2;
   gfc_code *co = *c;
   gfc_expr *n;
 
-  *walk_subtrees = 0;
   if (co->op != EXEC_ASSIGN)
     return 0;
 
index 6dcb331345231f82d2df389e577c8e892ece84e9..3a56e66ac8894e037c5f12d656ca70cba5a455f2 100644 (file)
@@ -1,3 +1,9 @@
+2016-02-28  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/68147
+       PR fortran/47674
+       * gfortran.dg/realloc_on_assign_26.f90:  New test case.
+
 2016-02-28  Harald Anlauf <anlauf@gmx.de>
            Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
diff --git a/gcc/testsuite/gfortran.dg/realloc_on_assign_26.f90 b/gcc/testsuite/gfortran.dg/realloc_on_assign_26.f90
new file mode 100644 (file)
index 0000000..4791c24
--- /dev/null
@@ -0,0 +1,12 @@
+! { dg-do run }
+! PR 68147 - no temprorary within the IF statement.
+! Original test case by Martin Reinecke.
+program test
+  implicit none
+  character(len=:),allocatable ::name
+  name="./a.out"
+  if (index(name,"/")  /=  0) THEN
+    name=name(3:)
+    if (name .ne. "a.out") call abort
+  endif
+end program