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

--- Comment #5 from G. Steinmetz <gs...@t-online.de> ---

Looking at variations z1..z4 with two data statements
and combinations z5..z8 with one data statement only :


# cat z1.f90
# ICE, see comment above


$ cat z2.f90
program p
   type t
      character(3) :: c
      integer :: i
   end type
   type t2
      type(t) :: a
   end type
   type(t2) :: x
   data x%a%i / 1 /
   data x%a%c / 'abc' /
   print *, x
end
$ gfortran-9-20181021 -static-libgfortran z2.f90
$ a.out
 abc           1


$ cat z3.f90
program p
   type t
      integer :: i
      character(3) :: c
   end type
   type t2
      type(t) :: a
   end type
   type(t2) :: x
   data x%a%c / 'abc' /
   data x%a%i / 1 /
   print *, x
end
$ gfortran-9-20181021 -static-libgfortran z3.f90
$ a.out
           1 abc


$ cat z4.f90
program p
   type t
      character(3) :: c
      integer :: i
   end type
   type t2
      type(t) :: a
   end type
   type(t2) :: x
   data x%a%c / 'abc' /
   data x%a%i / 1 /
   print *, x
end
# ICE, see comment above


$ cat z5.f90
program p
   type t
      integer :: i
      character(3) :: c
   end type
   type t2
      type(t) :: a
   end type
   type(t2) :: x
   data x%a%i / 1 /
   print *, x
end
$ gfortran-9-20181021 -static-libgfortran z5.f90
$ a.out
           1


$ cat z6.f90
program p
   type t
      integer :: i
      character(3) :: c
   end type
   type t2
      type(t) :: a
   end type
   type(t2) :: x
   data x%a%c / 'abc' /
   print *, x
end

# ICE when configured with --enable-checking=yes
$ gfortran-9-20181021-chk -c z6.f90
z6.f90:12:0:

   12 | end
      |
internal compiler error: in output_constant, at varasm.c:4986
0xf8f91c output_constant
        ../../gcc/varasm.c:4986
0xf90f2d output_constant
        ../../gcc/varasm.c:5219
0xf90f2d output_constructor_regular_field
        ../../gcc/varasm.c:5219
0xf90f2d output_constructor
        ../../gcc/varasm.c:5490
0xf90f2d output_constant
        ../../gcc/varasm.c:5219
0xf90f2d output_constructor_regular_field
        ../../gcc/varasm.c:5219
0xf90f2d output_constructor
        ../../gcc/varasm.c:5490
0xf920c9 output_constant
        ../../gcc/varasm.c:4858
0xf920c9 assemble_variable_contents
        ../../gcc/varasm.c:2140
0xf9b12a assemble_variable(tree_node*, int, int, int)
        ../../gcc/varasm.c:2319
0xf9f414 varpool_node::assemble_decl()
        ../../gcc/varpool.c:586
0x828fdc output_in_order
        ../../gcc/cgraphunit.c:2442
0x828fdc symbol_table::compile()
        ../../gcc/cgraphunit.c:2682
0x82b9c6 symbol_table::compile()
        ../../gcc/cgraphunit.c:2864
0x82b9c6 symbol_table::finalize_compilation_unit()
        ../../gcc/cgraphunit.c:2861


$ cat z7.f90
program p
   type t
      character(3) :: c
      integer :: i
   end type
   type t2
      type(t) :: a
   end type
   type(t2) :: x
   data x%a%c / 'abc' /
   print *, x
end
$ gfortran-9-20181021 -static-libgfortran z7.f90
$ a.out
 abc           0


$ cat z8.f90
program p
   type t
      character(3) :: c
      integer :: i
   end type
   type t2
      type(t) :: a
   end type
   type(t2) :: x
   data x%a%i / 1 /
   print *, x
end
# ICE, see comment above

Reply via email to