[Patch, fortran] PR45081 - [4.3/4.4/4.5/4.6 Regression] ICE in gfc_conv_array_initializer, at fortran/trans-array.c:4208

Dominique Dhumieres dominiq@lps.ens.fr
Mon Sep 20 19:22:00 GMT 2010


Paul,

> I have just realised that the code is not valid; the shape of the
> result is (1,2).  If you change the dimension of c accordingly, the
> example compiles.

No! If I use dimension(1,2) or (2,1) gfortran complains that I
ma assigning a rank 1 array to a rank 2 one. a(1) is a scalar (it is 
allowed), hence the result of spread is a rank 1 array.
If I try
fter commenting the line with spread

  use m
  type(t) :: c(2)
  c = spread ( a1(1), dim=1, ncopies=2 )
  print *, c
end

gfortran compiles and the result is

[macbook] f90/bug% a.out
           1           1

Dominique



More information about the Fortran mailing list