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

Paul Richard Thomas paul.richard.thomas@gmail.com
Mon Sep 20 19:25:00 GMT 2010


Oops, sorry.  Where I had got to is:

module m
   implicit none
   type t
     integer :: i
   end type t
   type(t), dimension(2), parameter :: a1  = (/ t(1), t(2) /)
   type(t), dimension(1,2), parameter :: c = spread ( a1, 1, 1 )
 end module m
 use m
 print *,c
end

Cheers

Paul

On Mon, Sep 20, 2010 at 7:56 PM, Dominique Dhumieres <dominiq@lps.ens.fr> wrote:
> 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
>
>



-- 
The knack of flying is learning how to throw yourself at the ground and miss.
       --Hitchhikers Guide to the Galaxy



More information about the Fortran mailing list