]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/39292 (ICE in gfc_conv_array_initializer, at fortran/trans-array.c...
authorPaul Thomas <pault@gcc.gnu.org>
Sat, 7 Mar 2009 15:56:37 +0000 (15:56 +0000)
committerPaul Thomas <pault@gcc.gnu.org>
Sat, 7 Mar 2009 15:56:37 +0000 (15:56 +0000)
2009-03-07  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/39292
* trans-array.c (gfc_conv_array_initializer): Convert all
expressions rather than ICEing.

2009-03-07  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/39292
* gfortran.dg/initialization_22.f90: New test.

From-SVN: r144694

gcc/fortran/ChangeLog
gcc/fortran/trans-array.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/initialization_22.f90 [new file with mode: 0644]

index 993d7e47b84aed3f06aecef9bc377af1cb624db8..00aefcb241b661600d49dd6393ddc9bc43f0535f 100644 (file)
@@ -1,3 +1,9 @@
+2009-03-07  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/39292
+       * trans-array.c (gfc_conv_array_initializer): Convert all
+       expressions rather than ICEing.
+
 2009-02-19  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/38852
index cbf3b561550599ce536d3b256b9e2c7885895430..5ac1d755482c01358e180a6a07b4b84a26cdb481 100644 (file)
@@ -3867,8 +3867,21 @@ gfc_conv_array_initializer (tree type, gfc_expr * expr)
              CONSTRUCTOR_APPEND_ELT (v, index, se.expr);
              break;
 
+
            default:
-             gcc_unreachable ();
+             /* Catch those occasional beasts that do not simplify
+                for one reason or another, assuming that if they are
+                standard defying the frontend will catch them.  */
+             gfc_conv_expr (&se, c->expr);
+             if (range == NULL_TREE)
+               CONSTRUCTOR_APPEND_ELT (v, index, se.expr);
+             else
+               {
+                 if (index != NULL_TREE)
+                 CONSTRUCTOR_APPEND_ELT (v, index, se.expr);
+                 CONSTRUCTOR_APPEND_ELT (v, range, se.expr);
+               }
+             break;
            }
         }
       break;
index 6b02c45e2fc53226de06e94cc634c7906c99f8c3..9d269c2140a27f130e683994df885771cbcf5e92 100644 (file)
@@ -1,3 +1,8 @@
+2009-03-07  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/39292
+       * gfortran.dg/initialization_22.f90: New test.
+
 2009-03-04  Jason Merrill  <jason@redhat.com>
            Giovanni Bajo  <giovannibajo@gcc.gnu.org>
 
diff --git a/gcc/testsuite/gfortran.dg/initialization_22.f90 b/gcc/testsuite/gfortran.dg/initialization_22.f90
new file mode 100644 (file)
index 0000000..f788109
--- /dev/null
@@ -0,0 +1,10 @@
+! { dg-do run }
+! tests the fix for PR39292, where the intitialization expression
+! did not simplify and caused an ICE in gfc_conv_array_initializer.
+!
+! Contributed by Richard Guenther <rguenth@gcc.gnu.org>
+!
+  integer :: n
+  real, dimension(2) :: a = (/ ( (float(n))**(1.0), n=1,2) /)
+  if (any (a .ne. (/ ( (float(n))**(1.0), n=1,2) /))) call abort
+end