This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gfortran testsuite, committed] Re: gfortran.dg/forall_1.f90


Jakub Jelinek wrote:
>>Yes, XFAIL the testcase and open a PR.  NAG's compiler also compiles
>>the program and it executes without a problem.
> 
> 
> FYI, the bug is in the
> forall (i=1:15, j=1:10, a1(j)%k <= j)
>    i2(i,j) = j + i*11
> end forall
> 
> code.  The temp array of logical4 (logical4 temp.26[150]; in my case,
> BTW, does it really have to be logical4, can't be some 8 bit type?)
> is computed correctly (150x .true.), but when used to see
> if i2(i,j) should be stored or not, it advances by 16 logical4s
> each time instead of 15, so in the last round it accesses 10 words
> after the end of the array.

I've seen that you posted a fix already, but I'd like to comment on those
points: since there's no dependency between the mask and the assignments, I
don't see why a temporary should be necessary at all, calculating the mask
beforehand sounds like a real performance-killer.  Especially because it's
calculated ten times over in this case.

If we were more efficient in deciding what we need to know about the mask, we
could probably be much more efficient than by optimizing the way we're
representing the mask in memory.  Obviously, the former is a difficult  task,
whereas the latter will be fairly easy, so we should probably go for it.

- Tobi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]