This is the mail archive of the gcc-bugs@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]

[Bug fortran/41807] [4.5/4.4 Regression] data statement with nested type constructors



------- Comment #18 from jvdelisle at gcc dot gnu dot org  2009-11-21 22:15 -------
Here is a tentative patch.  I removed the offending code and ran the testsuite
to see what would happen.  The only failure was the test case associated with
patch that caused the regression.  This failure was an ICE on and assert.  So i
thought, why not just replace that assert with the error message, and it
appears to work.  It even sort of make sense, its not very intrusive, and it
passes regression testing on x86-64.

Any opinions?  Shall we just uuse this?

Index: trans-const.c
===================================================================
--- trans-const.c       (revision 154411)
+++ trans-const.c       (working copy)
@@ -340,7 +340,7 @@ void
 gfc_conv_constant (gfc_se * se, gfc_expr * expr)
 {
   /* We may be receiving an expression for C_NULL_PTR or C_NULL_FUNPTR.  If
-     so, they expr_type will not yet be an EXPR_CONSTANT.  We need to make
+     so, the expr_type will not yet be an EXPR_CONSTANT.  We need to make
      it so here.  */
   if (expr->ts.type == BT_DERIVED && expr->ts.u.derived
       && expr->ts.u.derived->attr.is_iso_c)
@@ -353,7 +353,11 @@ gfc_conv_constant (gfc_se * se, gfc_expr * expr)
         }
     }

-  gcc_assert (expr->expr_type == EXPR_CONSTANT);
+  if (expr->expr_type != EXPR_CONSTANT)
+    {
+      gfc_error ("non-constant DATA value at %L", &expr->where);
+      return;
+    }

   if (se->ss != NULL)
     {
Index: resolve.c
===================================================================
--- resolve.c   (revision 154411)
+++ resolve.c   (working copy)
@@ -11083,9 +11083,6 @@ next_data_value (void)
 {
   while (mpz_cmp_ui (values.left, 0) == 0)
     {
-      if (!gfc_is_constant_expr (values.vnode->expr))
-       gfc_error ("non-constant DATA value at %L",
-                  &values.vnode->expr->where);

       if (values.vnode->next == NULL)
        return FAILURE;


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41807


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