re PR fortran/71204 (ICE with -O0 in expand_expr_real_1, at expr.c:9651)
authorJakub Jelinek <jakub@redhat.com>
Fri, 20 May 2016 18:49:24 +0000 (20:49 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 20 May 2016 18:49:24 +0000 (20:49 +0200)
PR fortran/71204
* frontend-passes.c (realloc_string_callback): Clear inserted_block
and changed_statement before calling create_var.

* gfortran.dg/pr71204.f90: New test.

From-SVN: r236525

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

index 704c1f169f2b2d0da7ef1e51a8a695fd4a3862bb..d32c7d5100a9fb54173a14ce28170e4d30b8b168 100644 (file)
@@ -1,3 +1,9 @@
+2016-05-20  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/71204
+       * frontend-passes.c (realloc_string_callback): Clear inserted_block
+       and changed_statement before calling create_var.
+
 2016-05-15  Harald Anlauf  <anlauf@gmx.de>
 
        PR fortran/69603
index 9d724dec0cd1a133aee23fa8bd00e1882ca904b1..37c42bb5e345060c2306fe28dd9f81b73b9aeb22 100644 (file)
@@ -174,8 +174,10 @@ realloc_string_callback (gfc_code **c, int *walk_subtrees ATTRIBUTE_UNUSED,
 
   if (!gfc_check_dependency (expr1, expr2, true))
     return 0;
-  
+
   current_code = c;
+  inserted_block = NULL;
+  changed_statement = NULL;
   n = create_var (expr2, "trim");
   co->expr2 = n;
   return 0;
index 919c1241f3a0e63796909bd2ab0ccd14ab7a0d04..d5122e82cc1be8f81356ff10858bf468734dd887 100644 (file)
@@ -1,3 +1,8 @@
+2016-05-20  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/71204
+       * gfortran.dg/pr71204.f90: New test.
+
 2016-05-20  Cesar Philippidis  <cesar@codesourcery.com>
 
        * gcc.target/nvptx/sincos.c: New test.
diff --git a/gcc/testsuite/gfortran.dg/pr71204.f90 b/gcc/testsuite/gfortran.dg/pr71204.f90
new file mode 100644 (file)
index 0000000..1d1ee5c
--- /dev/null
@@ -0,0 +1,17 @@
+! PR fortran/71204
+! { dg-do compile }
+! { dg-options "-O0" }
+
+module pr71204
+  character(10), allocatable :: z(:)
+end module
+
+subroutine s1
+  use pr71204
+  z(2) = z(1)
+end
+
+subroutine s2
+  use pr71204
+  z(2) = z(1)
+end