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

2017-04-10 Thread Glenn.Hyland at utas dot edu.au
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80388

Bug ID: 80388
   Summary: ICE in output_constructor_regular_field, at
varasm.c:4986
   Product: gcc
   Version: 5.4.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: Glenn.Hyland at utas dot edu.au
  Target Milestone: ---

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

2017-04-11 Thread Glenn.Hyland at utas dot edu.au
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80388

--- Comment #2 from Glenn Hyland  ---
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  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.0008.1.

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

2017-04-11 Thread Glenn.Hyland at utas dot edu.au
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80388

--- Comment #4 from Glenn Hyland  ---
Thanks. I'm already at the latest gFortran release for my platform "Ubuntu
16.04.2 LTS". Not prepared at this stage to go to a development version of
Ubuntu that would include a newer compiler version.

I'm happy to use the workaround that gives me a working solution, and to make a
note about the potential problem with pre-6.3.1 versions of the compiler.
Thanks for your help.