Use of spread intrinsic

Steve Kargl sgk@troutmask.apl.washington.edu
Thu Jun 9 17:33:00 GMT 2005


On Thu, Jun 09, 2005 at 02:42:12PM +0200, Neilen Marais wrote:
> 
> PROGRAM ding
>   IMPLICIT NONE
>   PRINT*, SPREAD(1.0,1,4)
> END PROGRAM ding
> 
> Running this program when compiled with gfortran goes off into an
> infinite loop, while the intel fortran compiled version gives:
> 
> $ ./ding
>    1.000000       1.000000       1.000000       1.000000    
> 
> If I change the code to:
> 
>   PRINT*, SPREAD((/1.0/),1,4)
> 
> both ifort and gfortran produce identical output, as above.
> 
> Is the first case an extension of some sort, or should both work?

The 1st case appears to be legal code.  Please submit a bug
report at gcc.gnu.org.

BTW, on amd64-*-freebsd, I don't get an infinite loop.  I 
get 
troutmask:kargl[238] ./z
At line 3 of file jk.f90
Operating system error: Cannot allocate memory
Memory allocation failed


-- 
Steve



More information about the Fortran mailing list