This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/18495] Intrinisc function SPREAD is broken
- From: "Thomas dot Koenig at online dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Mar 2005 23:33:08 -0000
- Subject: [Bug libfortran/18495] Intrinisc function SPREAD is broken
- References: <20041115053618.18495.paulthomas2@wanadoo.fr>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From Thomas dot Koenig at online dot de 2005-03-09 23:33 -------
This looks very much like a front end bug. The
"along" parameter gets the wrong value.
Look at this:
$ cat test_spread.f90
program test_spread
implicit none
integer, parameter :: N = 1000
integer :: I
integer, dimension(N) :: source
integer, dimension(N,N) :: sink
do i = 1 , N
source(i) = N
end do
print *,'product'
sink = spread( source , 1 , N ) * spread( source , N , N )
print *, sink
stop
end program test_spread
$ gfortran -fdump-tree-original test_spread.f90
>From the *.t02.original file:
L.2:;
_gfortran_filename = "test_spread.f90";
_gfortran_line = 10;
_gfortran_ioparm.unit = 6;
_gfortran_ioparm.list_format = 1;
_gfortran_st_write ();
_gfortran_transfer_character ("product", 7);
_gfortran_st_write_done ();
{
int4 C.512 = 1000;
int4 C.511 = 1000;
struct array1_int4 parm.3;
struct array2_int4 atmp.2;
int4 C.492 = 1000;
int4 C.491 = 1;
struct array1_int4 parm.1;
struct array2_int4 atmp.0;
... and further down:
parm.1.dtype = 265;
parm.1.dim[0].lbound = 1;
parm.1.dim[0].ubound = 1000;
parm.1.dim[0].stride = 1;
parm.1.data = (int4[0:] *) (int4[0:] *) &source[0];
parm.1.offset = 0;
_gfortran_spread (&atmp.0, &parm.1, &C.491, &C.492);
^^^^^^
This is =1000, which is bogus
The last parameter of spread is "along", which is supposed
to give the dimension. 1000 is a bit too high :-)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18495