------- Additional Comments From tkoenig at gcc dot gnu dot org  2005-04-15 
19:39 -------
Spread putting its result into temporary
arrays does indeed do something strange, even if
the front end is providing the space.  This is with
an unpatched spread_generic.c:

program test_spread
   implicit none
   integer, parameter :: N = 4
   integer            :: I
   integer, dimension(N) :: source
   integer, dimension(N,N) :: temp, sink

   source = (/(i,i=1,4)/)
   temp = spread (source, 1, N )
   sink = spread( source , 1 , N ) + 0
   print *,'On the fly:'
   print '(1x,4I12)',sink
   print *,'Using temporary array:'
   sink = temp + 0
   print '(1x,4I12)',sink
end program test_spread
$ gfortran t1.f90
$ ./a.out
 On the fly:
            1   437457152   386863616          22
            2   134537768          12  1075739744
            3           1    16774548  1073850628
            4  1073772283  1073853733   134513615
 Using temporary array:
            1           1           1           1
            2           2           2           2
            3           3           3           3
            4           4           4           4

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18495

Reply via email to