[Bug libfortran/18495] Intrinisc function SPREAD is broken
paulthomas2 at wanadoo dot fr
gcc-bugzilla@gcc.gnu.org
Mon Nov 15 14:58:00 GMT 2004
------- Additional Comments From paulthomas2 at wanadoo dot fr 2004-11-15 14:58 -------
Looking at the source of SPREAD, I note that it does not assert the rank of the
output matrix. Thus, in the fragment from the LLNL test it should be possible
to output the calls to SPREAD to temporary arrays, multiply these and add them
to the result. Thus:
DO K = 1, 25
PRTTEMP = SPREAD(VY(:25,K),DIM = 2,NCOPIES = N)
PRTTEMP = PRTTEMP * SPREAD(CX(K,:N),DIM = 1,NCOPIES = 25)
PX(:,:N) = PX(:,:N) + PRTTEMP
!! PX(:,:N) = PX(:,:N) + SPREAD(VY(:25,K),DIM = 2,NCOPIES = N)* &
!! & SPREAD(CX(K,:N),DIM = 1,NCOPIES = 25)
END DO
works but the commented out part does not.
Is the caller or the callee responsible for asserting the rank of the output?
If the latter, the fix is trivial. If the former, the problem is not with
SPREAD but with the compiler front-end not assigning intermediate temporaries
the correct rank.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18495
More information about the Gcc-bugs
mailing list