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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #2 from kargl at gcc dot gnu.org ---
(In reply to Dominique d'Humieres from comment #0)
> Compiling the following test (coming from pr55501)
> 
> program testmerge3
>   implicit none
>   integer,parameter::iarray(merge(2,3,.true.)) = 1, i = size(iarray)
>   print "(A,99I2)",'i,iarray =',i,iarray
> end program testmerge3
> 
> gives the ICE
> 
> pr55501_3.f90:4:0:
> 
>    print "(A,99I2)",'i,iarray =',i,iarray
>  
> internal compiler error: in gfc_conv_expr_descriptor, at
> fortran/trans-array.c:6972
> 
> (gcc_assert (ss != gfc_ss_terminator);).

If the code is changed to 

program testmerge3
  implicit none
  integer, parameter :: j = merge(2,3,.true.)
  integer, parameter :: iarray(j) = 1
  integer, parameter :: i = size(iarray)
  print "(A,99I2)",'i,iarray =', i, iarray
end program testmerge3

it compiles and runs.  The problems appears to be that
when merge is in iarray, then array's shape is not properly
set.  For my modified program, we have 

(gdb) p *array
$4 = {expr_type = EXPR_VARIABLE, ts = {type = BT_INTEGER, kind = 4, u = {
      derived = 0x0, cl = 0x0, pad = 0}, interface = 0x0, is_c_interop = 0, 
    is_iso_c = 0, f90_type = BT_UNKNOWN, deferred = false, 
    interop_kind = 0x0}, rank = 1, shape = 0x201e628c0, symtree = 0x201d58630, 

for the original program

(gdb) p *array
$5 = {expr_type = EXPR_VARIABLE, ts = {type = BT_INTEGER, kind = 4, u = {
      derived = 0x0, cl = 0x0, pad = 0}, interface = 0x0, is_c_interop = 0, 
    is_iso_c = 0, f90_type = BT_UNKNOWN, deferred = false, 
    interop_kind = 0x0}, rank = 1, shape = 0x0, symtree = 0x201d58630, 

Not sure where the array->shape should be set.

Reply via email to