This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/80388] ICE in output_constructor_regular_field, at varasm.c:4986


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

--- Comment #2 from Glenn Hyland <Glenn.Hyland at utas dot edu.au> ---
Sorry - hit return too early. Example code below (example.f90) generates ICE at
varasm.c:4986 ...

program example

integer, parameter :: r8 = selected_real_kind(14,30)

type test
    real (r8) :: computation_accuracy
    real (r8), dimension(2) :: values
end type test

type(test) :: temp

data temp / test( 10, (/8, 1/) ) /              ! this gives an ICE

print *, temp

return
end

$ gfortran -c example.f90
example.f90:17:0:

 end
 ^
internal compiler error: in output_constructor_regular_field, at varasm.c:4986
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.


Replacing the data declaration line with ...

data temp / test( 10_r8, (/8_r8, 1_r8/) ) /     ! compiles - prints wrong
result

allows the program to be compiled, but gives the wrong result.

$ gfortran -c example.f90
$ gfortran example.o -o example
$ ./example 
   4.9406564584124654E-323   3.9525251667299724E-323   4.9406564584124654E-324

Replacing the data declaration line with ...

data temp / test( 10._r8, (/8._r8, 1._r8/) ) /  ! this is ok

is ok - compiles without error and prints the right result.

$ ./example 
   10.000000000000000        8.0000000000000000        1.0000000000000000

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]