[Bug fortran/78277] ICE in is_anonymous_component, at fortran/interface.c:450

foreese at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Nov 10 17:08:00 GMT 2016


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

foreese at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2016-11-09 00:00:00         |2016-11-10
           Assignee|unassigned at gcc dot gnu.org      |foreese at gcc dot gnu.org
   Target Milestone|---                         |7.0

--- Comment #2 from foreese at gcc dot gnu.org ---
(In reply to Gerhard Steinmetz from comment #0)
> Invalid code together with option -fdec, affects versions 6 and 7 :
> 
...
> $ gfortran-7-20161106 -fdec -c z1.f90
> z1.f90:11:19:
> 
>          structure t.
>                    1
> Error: Syntax error in data declaration at (1)
> z1.f90:14:9:
> 
>        end structure
>          1
> Error: Expecting END SUBROUTINE statement at (1)
> f951: internal compiler error: Segmentation fault
> 0xc3a64f crash_signal
>         ../../gcc/toplev.c:338
> 0x6952d0 is_anonymous_component
...

I'll have a patch soon.

For the curious reader:

The underlying cause is the fact that an anonymous structure declaration is
created at the line of error "structure t.", but the data declaration error
aborts the matcher and undoes the parse stack for the following structure
declaration which should become part of the anonymous definition. This doesn't
allow the matcher to finish the anonymous declaration. 

Due to the abort, the following components are added to the enclosing
"structure /s/", and the anonymous inner structure is never completed. The ICE
is specifically because the "zero_comp" attribute is never set, even though the
abort of the matcher causes no components to be assigned to the inner
structure.

The correct solution is not just to add null-guards to compare_components;
rather to fix the error handling around the bad anonymous inner structure
declaration. The anonymous inner structure should continue being parsed as
normal, while an error is still emitted about the bad variable-decl ("t.").


More information about the Gcc-bugs mailing list