This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Remove testsuite/gcc.c-torture/execute/20000603-1.c
On Thu, 2004-02-05 at 17:35, Joseph S. Myers wrote:
> > - struct s1 { double d; };
> > - struct s2 { double d; };
> union u { struct s1 x; struct s2 y; };
>
> > - double f(struct s1 *a, struct s2 *b)
> > - {
> > - a->d = 1.0;
> > - return b->d + 1.0;
> > - }
> > -
> > - int main()
> > - {
> > - struct s1 a;
> > - a.d = 0.0;
> > - if (f (&a, (struct s2 *)&a) != 2.0)
>
> change to
>
> union u a;
> a.x.d = 0.0;
> if (f (&a.x, &a.y) != 2.0)
Yes, that works. With the previous test case, we would get the
following type-based alias info for 'a' and 'b':
a, UID 2, type memory tag: TMT.8, is written to, is dereferenced to store
b, UID 3, type memory tag: TMT.7, is written to, is dereferenced to load
TMT.7, UID 10
TMT.8, UID 11, is written to, may aliases: { a }
'Memory tags' are artificial variable representing the memory pointed-to
by their associated pointer. TBAA creates one memory tag per alias set
found in the program. Notice how TMT.7 (*b) was not aliased to
anything. Essentially because alias_sets_conflict_p() returns 'false'.
With your modifications, we get:
a, UID 3, type memory tag: TMT.10, is written to, is dereferenced to store
b, UID 4, type memory tag: TMT.9, is written to, is dereferenced to load
TMT.9, UID 12, may aliases: { a }
TMT.10, UID 13, is written to, may aliases: { a }
Now both memory tags alias 'a', so DCE won't remove one of the stores.
Should I commit the test cases with these changes?
Thanks. Diego.