[Bug fortran/65428] ICE on nest array constructor
kargl at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Mar 21 23:06:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65428
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
--- Comment #6 from kargl at gcc dot gnu.org ---
(In reply to Francois-Xavier Coudert from comment #1)
> The original example is Fortran 2003 (array constructor with type
> specification). Here is a pure Fortran 95 example, which is also an
> ice-on-valid-code:
>
> integer :: i
> print *, (/ (/ (i, i=1,0) /) /)
> end
>
I looked at this quickly. It seems the reduction of the
inner array constructor to a zero size array does not set
ts.type to BT_INTEGER or any other type. It is left as
BT_UNKNOWN. So, when the second array constructor is
handed a zero sized array with unknown type, gfortran hits
gcc_unreachable() in trans-types.c(gfc_typenode_for_spec).
Changing the above code to
integer :: i
print *, (/ integer :: (/ (i, i = 1, 0) /) /)
end
one gets the right answer. So, this PR is fixed by
finding where to set the type to the implied-do-objects
type.
More information about the Gcc-bugs
mailing list