causes for an invalid memory reference?

Damian Rouson damian@sourceryinstitute.org
Mon Feb 25 06:11:00 GMT 2019


On Sun, Feb 24, 2019 at 4:33 PM Steve Kargl
<sgk@troutmask.apl.washington.edu> wrote:
>
> Clever uses of an implied-do-loop can cause very difficult to
> fix bugs (either in one's code or a compiler).  I suspect that
> you're getting one (or more) temporary array(s) with issues
> with the bounds.  Using -fdump-tree-original might shed some
> light on how the implied-do-loop and the user defined operator
> are interacting.

Thanks, Steve.  I probably should have mentioned that the
problem was first identified with a regular do loop of the form

     derivU(:,np1) = 0.
     do k = 0, km
       uxb(:) = derivU(:,n-k) .cross. derivB(:,k)
       derivU(:,np1) = derivU(:,np1) + PascalEntry(psn + k) * uxb(:)
     end do

Part of the reason I switched to the implied do loop was to take
advantage of the SUM intrinsic function.  The other part was
because I try to make code as compact as possible before
submitting the code to compiler developers.  In this case, the
same behavior happens with the DO loop and the implied DO loop.

Damian



More information about the Fortran mailing list