[Bug fortran/45128] Segmentation fault with -fwhole-file for subref_array_pointer

burnus at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Jul 29 14:44:00 GMT 2010



------- Comment #1 from burnus at gcc dot gnu dot org  2010-07-29 14:44 -------
Carry over the comment from PR 45125, where I had posted it initially (and
accidentally).

The segfault occurs for:

l.4768             gfc_add_modify (&lse.post, GFC_DECL_SPAN(decl), tmp);

It seems as if GFC_DECL_SPAN(decl) access a NULL pointer. That's
  decl->decl_common.lang_specific->span
where lang_specific == NULL.

While the dump has:

tf_ad_splitting_driver_plane ()
{
  extern integer(kind=8) span.0 = 0;
  [...]
    span.0 = 4;

the "span" variable does not really exist globally but is only created when
needed, cf.
http://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/fortran/trans-decl.c;hb=HEAD#l1243

gfc_get_symbol_decl:

1243   else if (sym->attr.subref_array_pointer)
1245       /* We need the span for these beasts.  */
1246       gfc_allocate_lang_decl (decl);

1249   if (sym->attr.subref_array_pointer)
1261       GFC_DECL_SPAN (decl) = span;

If one now recycles the definition for the array descriptor "desc" this
information is not present. I think the real solution is the new array
descriptor. I do not know how to fix this otherwise - except by always
generating a span variable.

Paul - any progress from the array-descriptor front?


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pault at gcc dot gnu dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|0000-00-00 00:00:00         |2010-07-29 14:44:16
               date|                            |
            Summary|Segmentation fault with -   |Segmentation fault with -
                   |fwhole-file                 |fwhole-file  for
                   |                            |subref_array_pointer


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



More information about the Gcc-bugs mailing list