------- Comment #2 from paul dot richard dot thomas at cea dot fr  2006-09-14 
08:45 -------
Created an attachment (id=12265)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12265&action=view)
Patch to provide the shape of the SPREAD intrinsic + testcase

(In reply to comment #1)
> Yes, it appears to be related to spread.  If you comment out the 
> spread() in the subroutine the compiles.  Additionally, if you
> change "x%position(:,1:2)" to "x%position(1:3,1:2)", then the
> code compiles.  So, it looks like gfortran isn't interpreting the
> index ranges from spread correctly if the lefthand side doesn't
> have explicit ranges of indicies.
Steve,

That's right; neither the parameter array nor the call to SPREAD are passing
the shape information to the scalarizer. Replacing the parameter by a variable
permits the compilation to succeed.

This is a minimal test case that illustrates the problem:

  real,dimension(:,:),pointer :: ptr
  real,dimension(1,2),parameter :: u = reshape((/ 0.25,0.75 /),(/1,2/))
  ptr(:,:) = u + spread((/1.0/),2,size(u,2))
end

It is fixed by the attached, as yet, unregtested patch.  You will also find a
dejagnuified testcase.

I will do the regtest this afternoon and will submit tonight.

Best regards

Paul


-- 


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

Reply via email to