Commit 391f9afb by Diego Novillo Committed by Diego Novillo

re PR tree-optimization/17252 (not marking char types as aliasing anything)


	PR tree-optimization/17252
	* tree-ssa-alias.c (may_alias_p): Don't assume that a
	pointer may not point to itself when using relaxed
	aliasing rules.

testsuite/ChangeLog

	PR tree-optimization/17252
	* gcc.c-torture/execute/pr17252.c: New test.

From-SVN: r87529
parent 67f23620
2004-09-14 Diego Novillo <dnovillo@redhat.com>
PR tree-optimization/17252
* tree-ssa-alias.c (may_alias_p): Don't assume that a
pointer may not point to itself when using relaxed
aliasing rules.
2004-09-14 Richard Henderson <rth@redhat.com> 2004-09-14 Richard Henderson <rth@redhat.com>
PR middle-end/17397 PR middle-end/17397
......
2004-09-14 Diego Novillo <dnovillo@redhat.com>
PR tree-optimization/17252
* gcc.c-torture/execute/pr17252.c: New test.
2004-09-14 Andrew Pinski <apinski@apple.com> 2004-09-14 Andrew Pinski <apinski@apple.com>
* g++.dg/tree-ssa/pointer-reference-alias.C: New test. * g++.dg/tree-ssa/pointer-reference-alias.C: New test.
......
/* PR 17252. When a char * pointer P takes its own address, storing
into *P changes P itself. */
char *a;
main ()
{
int i;
/* Make 'a' point to itself. */
a = (char *)&a;
/* Assign NULL to 'a' byte by byte. */
for (i = 0; i < sizeof(char *); i++)
a[i] = 0;
/* If a's memory tag does not contain 'a' in its alias set, we will
think that this predicate is superfluous and change it to
'if (1)'. */
if (a == (char *)&a)
abort ();
return 0;
}
...@@ -1558,7 +1558,8 @@ may_alias_p (tree ptr, HOST_WIDE_INT mem_alias_set, ...@@ -1558,7 +1558,8 @@ may_alias_p (tree ptr, HOST_WIDE_INT mem_alias_set,
for PTR's alias set here, not its pointed-to type. We also can't for PTR's alias set here, not its pointed-to type. We also can't
do this check with relaxed aliasing enabled. */ do this check with relaxed aliasing enabled. */
if (POINTER_TYPE_P (TREE_TYPE (var)) if (POINTER_TYPE_P (TREE_TYPE (var))
&& var_alias_set != 0) && var_alias_set != 0
&& mem_alias_set != 0)
{ {
HOST_WIDE_INT ptr_alias_set = get_alias_set (ptr); HOST_WIDE_INT ptr_alias_set = get_alias_set (ptr);
if (ptr_alias_set == var_alias_set) if (ptr_alias_set == var_alias_set)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment