c-common.c (c_get_alias_set): Fix support for poitners and references.

* c-common.c (c_get_alias_set): Fix support for poitners and
	references.

Co-Authored-By: Mark Mitchell <mark@codesourcery.com>

From-SVN: r28768
This commit is contained in:
Mike Stump 1999-08-19 21:39:04 +00:00 committed by Mark Mitchell
parent 2aaf816dad
commit 02af3af651
2 changed files with 39 additions and 3 deletions

View File

@ -1,3 +1,9 @@
Thu Aug 19 14:42:38 1999 Mike Stump <mrs@wrs.com>
Mark Mitchell <mark@codesourcery.com>
* c-common.c (c_get_alias_set): Fix support for poitners and
references.
Thu Aug 19 11:51:22 EDT 1999 John Wehle (john@feith.com)
* alias.c: Include tree.h.

View File

@ -3401,11 +3401,41 @@ c_get_alias_set (t)
whose type is the same as one of the fields, recursively, but
we don't yet make any use of that information.) */
TYPE_ALIAS_SET (type) = 0;
else if (TREE_CODE (type) == POINTER_TYPE
|| TREE_CODE (type) == REFERENCE_TYPE)
{
tree t;
/* Unfortunately, there is no canonical form of a pointer type.
In particular, if we have `typedef int I', then `int *', and
`I *' are different types. So, we have to pick a canonical
representative. We do this below.
Note that this approach is actually more conservative that it
needs to be. In particular, `const int *' and `int *' should
be in different alias sets, but this approach puts them in
the same alias set. */
t = TYPE_MAIN_VARIANT (TREE_TYPE (type));
t = ((TREE_CODE (type) == POINTER_TYPE)
? build_pointer_type (t) : build_reference_type (t));
if (t != type)
TYPE_ALIAS_SET (type) = c_get_alias_set (t);
}
if (!TYPE_ALIAS_SET_KNOWN_P (type))
/* TYPE is something we haven't seen before. Put it in a new
alias set. */
TYPE_ALIAS_SET (type) = new_alias_set ();
{
/* Types that are not allocated on the permanent obstack are not
placed in the type hash table. Thus, there can be multiple
copies of identical types in local scopes. In the long run,
all types should be permanent. */
if (! TREE_PERMANENT (type))
TYPE_ALIAS_SET (type) = 0;
else
/* TYPE is something we haven't seen before. Put it in a new
alias set. */
TYPE_ALIAS_SET (type) = new_alias_set ();
}
return TYPE_ALIAS_SET (type);
}