[Bug fortran/92114] equivalence in module causes ICE

kargl at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Oct 16 17:02:00 GMT 2019


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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #1 from kargl at gcc dot gnu.org ---
(In reply to urbanjost from comment #0)
> module minimal
> implicit none
> logical,private :: help,h,version,v
> equivalence (help,h),(version,v)
> end module minimal
> 
>  GNU Fortran (GCC) 7.4.0
>  gfortran bug.f90
>  f951: internal compiler error: Segmentation fault
> 
>  might be similar to bug 77381, but error message is different.
>  
>  The only restriction in the standard that seemed to bear on this is
> 
>   C593 (R567) The name of an equivalence-object shall not be a name made
> accessible by use association.
> 
>  but all the variables are PRIVATE. It failed with all variable types I
> tried, not just LOGICAL.

C593 applies to a USEd associated variable.  Nothing is USEd associated
in your example.  C593 covers

% cat a.f90
module m
  integer num
end module m

program foo
   use m
   integer k
   equivalence(k,num)
   num = 1
   print *, k
end program foo
% gfcx -c a.f90
a.f90:8:20:

    8 |    equivalence(k,num)
      |                    1
Error: EQUIVALENCE attribute conflicts with USE ASSOCIATED attribute in 'num'
at (1)


For me, the code you posted compiles with 
GNU Fortran (GCC) 10.0.0 20191014 (experimental)
GNU Fortran (GCC) 9.2.1 20191011
GNU Fortran (GCC) 8.3.1 20191010
GNU Fortran (GCC) 7.4.1 20191010
GNU Fortran (GCC) 6.5.0

This may have been fixed by

r242802 | kargl | 2016-11-23 13:44:05 -0800 (Wed, 23 Nov 2016) | 10 lines

2016-11-23  Steven G. Kargl  <kargl@gcc.gnu.org>

        PR fortran/78297
        * trans-common.c (finish_equivalences): Do not dereference a NULL 
        pointer.

2016-11-23  Steven G. Kargl  <kargl@gcc.gnu.org>

        PR fortran/78297
        * gfortran.dg/pr78297.f90: New test.


More information about the Gcc-bugs mailing list