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

            Bug ID: 79685
           Summary: ICE on valid code in gfc_match_structur_constructor
           Product: gcc
           Version: 7.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: juergen.reuter at desy dot de
  Target Milestone: ---

Created attachment 40817
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40817&action=edit
Valid code producing the ICE.

The following code leads to an ICE with gfortran 7.0.1
$ gfortran -c ward.f90 
f951: internal compiler error: in gfc_match_structure_constructor, at
fortran/primary.c:2929

f951: internal compiler error: Abort trap: 6
It compiles, however, without problems with nagfor, ifort and even pgf. 
It already failed with gfortran 4.8.4 and 4.9.4, and most likely with the
gfortran 5 and 6 series as well. The problem seems to be using the derived type
in a data structure that was associated from another module under a different
name via
the use <module>, t_type => t_different_name   
construct. 
The code is here and also attached:

module omega_color
  implicit none
  private
  public :: omega_color_factor
  type omega_color_factor
     integer :: i1, i2
     real :: factor
  end type omega_color_factor

end module omega_color

!!!!!                                                                           

module foo
  use omega_color, OCF => omega_color_factor
  implicit none
  private

  integer, parameter :: n_cfactors = 1
  type(OCF), dimension(n_cfactors), save, protected :: table_color_factors
  real, parameter, private :: color_factor_000001 = +1.0
  data table_color_factors(     1) / OCF(1,1,color_factor_000001) /

end module foo

Reply via email to