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/65428] ICE on nest array constructor


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.

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