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/68154] [5/6 Regression] ICE on initializing character parameter array (explicit, implied)


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68154

--- Comment #3 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Thu, Oct 29, 2015 at 10:56:37PM +0000, dominiq at lps dot ens.fr wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68154
> 
> Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>              Status|UNCONFIRMED                 |NEW
>    Last reconfirmed|                            |2015-10-29
>                  CC|                            |kargl at gcc dot gnu.org
>             Summary|ICE on initializing         |[5/6 Regression] ICE on
>                    |character parameter array   |initializing character
>                    |(explicit, implied)         |parameter array (explicit,
>                    |                            |implied)
>      Ever confirmed|0                           |1
> 
> --- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> The tests in comment 0 compile with revisions up to r222230 (2015-04-20), but
> give an ICE from r222351 (2015-04-23), likely r222342 (pr65429) for trunk (6.0)
> and r222343 for 5.1.0.
> 

Index: decl.c
===================================================================
--- decl.c      (revision 229542)
+++ decl.c      (working copy)
@@ -1461,7 +1461,16 @@ add_init_expr_to_sym (const char *name, 
                    }
                  else if (init->expr_type == EXPR_ARRAY)
                    {
-                     clen = mpz_get_si (init->ts.u.cl->length->value.integer);
+                     if (init->ts.u.cl)
+                       clen = mpz_get_si
(init->ts.u.cl->length->value.integer);
+                     else if (init->value.constructor)
+                       {
+                         gfc_constructor *c;
+                         c = gfc_constructor_first (init->value.constructor);  
+                         clen = c->expr->value.character.length;
+                       }
+                     else
+                         clen = 1;
                      sym->ts.u.cl->length
                                = gfc_get_int_expr (gfc_default_integer_kind,
                                                    NULL, clen);


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