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: [Fortran] Improved dependency analysis of pointer variables


Quoting Roger Sayle <roger@eyesopen.com>:
> Ok, I've found the bug in gfc_are_equivalenced_arrays.  Its on line
> 450 of dependency.c in the following test:
>
>           if (fl1 && fl2 && (fl1->offset > fl2->offset))
>             return 1;
>
> For the test cases above, the offset of both "x" and "i" are zero,
> as they are the first items in their equivalence lists.  However,
> I'm unsure how best to fix this.  My first thought was that this
> test needs to be changed to (fl1->offset >= fl2->offset) but then
> I realized that this introduces/preserves a curious assymmetry.
> If "x" and "i" are equivalenced arrays, then "i" and "x" should
> also be equivalenced.
>
> If not precisely sure what "offset" is supposed to represent, but
> it if is a "byte" offset, i.e. a location in a COMMON block, then
> we'd also need a length field in gfc_equiv_info to detect/confirm
> an overlap.
>
>
> Can anyone suggest the appropriate way to fix this?

I marveled at that line earlier myself.  I think it's wrong.  If offset is the
number of storage units / bytes / whatever that the object is into the common
block, then the inequality would not be correct for a dependency where the
stride is negative (i.e. a(5:1:-1)), so I think the right course of action is
to remove that check, and only do smart stuff if there are no equivalences
involved.

- Tobi


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