This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Fortran] Improved dependency analysis of pointer variables
- From: Tobias Schlüter <Tobias dot Schlueter at Physik dot Uni-Muenchen dot DE>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: Paul Brook <paul at codesourcery dot com>, gcc-patches at gcc dot gnu dot org, FX Coudert <fxcoudert at gmail dot com>, fortran at gcc dot gnu dot org
- Date: Thu, 16 Mar 2006 16:43:01 +0100
- Subject: Re: [Fortran] Improved dependency analysis of pointer variables
- References: <Pine.LNX.4.44.0603160816160.10705-100000@www.eyesopen.com>
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