[Bug fortran/47850] [4.6 Regression] ICE in gfc_conv_array_initializer

pault at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Mar 6 16:19:00 GMT 2011


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

--- Comment #13 from Paul Thomas <pault at gcc dot gnu.org> 2011-03-06 16:19:02 UTC ---
(In reply to comment #12)
Jerry,

Based in this and comment #11, I noted that the place where this was failing
was iterator-free EXPR_ARRAYs.  I then leapt to the following patch, which is
just now regtesting (it's up to typebound_generic_4.f03):

Index: /svn/trunk/gcc/fortran/expr.c
===================================================================
*** /svn/trunk/gcc/fortran/expr.c    (revision 170337)
--- /svn/trunk/gcc/fortran/expr.c    (working copy)
*************** gfc_is_constant_expr (gfc_expr *e)
*** 937,952 ****
        return e->ref == NULL || (gfc_is_constant_expr (e->ref->u.ss.start)
                  && gfc_is_constant_expr (e->ref->u.ss.end));

      case EXPR_STRUCTURE:
!       for (c = gfc_constructor_first (e->value.constructor);
!        c; c = gfc_constructor_next (c))
      if (!gfc_is_constant_expr (c->expr))
        return 0;

        return 1;

-     case EXPR_ARRAY:
-       return gfc_constant_ac (e);

      default:
        gfc_internal_error ("gfc_is_constant_expr(): Unknown expression type");
--- 937,954 ----
        return e->ref == NULL || (gfc_is_constant_expr (e->ref->u.ss.start)
                  && gfc_is_constant_expr (e->ref->u.ss.end));

+     case EXPR_ARRAY:
      case EXPR_STRUCTURE:
!       c = gfc_constructor_first (e->value.constructor);
!       if ((e->expr_type == EXPR_ARRAY) && c && c->iterator)
!         return gfc_constant_ac (e);
! 
!       for (; c; c = gfc_constructor_next (c))
      if (!gfc_is_constant_expr (c->expr))
        return 0;

        return 1;


      default:
        gfc_internal_error ("gfc_is_constant_expr(): Unknown expression type");


Cheers

Paul



More information about the Gcc-bugs mailing list