aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1999-09-07 08:11:16 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1999-09-07 08:11:16 +0000
commit1176cc7b35644c50f9ad030617e4e213968a5443 (patch)
tree48956821e6b19cf66927b6efb6a41247882f3ed1 /gcc
parent2ee6b33cb15af2e3b3a26ff9a25005f5f4119cce (diff)
Sun Aug 29 03:27:23 1999 Scott Weikart <scott@igc.apc.org>
* fix-header.c (main): Do not pass a null pointer to strcmp. 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-2_95-branch@29161 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/c-common.c49
-rw-r--r--gcc/fix-header.c2
3 files changed, 55 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 643ee002945..d86ae8162df 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@
Tue Sep 7 01:27:21 1999 Jeffrey A Law (law@cygnus.com)
+ Sun Aug 29 03:27:23 1999 Scott Weikart <scott@igc.apc.org>
+ * fix-header.c (main): Do not pass a null pointer to strcmp.
+
+ 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.
+
Fri Aug 27 01:03:48 1999 Jim Kingdon <http://developer.redhat.com>
with much help from Jeffrey A Law and Richard Henderson
* i386.md: In the 6 insns which call output_fix_trunc,
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 0c201fbe58e..59dd407758d 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -3206,11 +3206,54 @@ 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.
+
+ Technically, this approach is actually more conservative that
+ it needs to be. In particular, `const int *' and `int *'
+ chould be in different alias sets, according to the C and C++
+ standard, since their types are not the same, and so,
+ technically, an `int **' and `const int **' cannot point at
+ the same thing.
+
+ But, the standard is wrong. In particular, this code is
+ legal C++:
+
+ int *ip;
+ int **ipp = &ip;
+ const int* const* cipp = &ip;
+
+ And, it doesn't make sense for that to be legal unless you
+ can dereference IPP and CIPP. So, we ignore cv-qualifiers on
+ the pointed-to types. This issue has been reported to the
+ C++ committee. */
+ 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);
}
diff --git a/gcc/fix-header.c b/gcc/fix-header.c
index af0577e43c4..1e6c5c47b8a 100644
--- a/gcc/fix-header.c
+++ b/gcc/fix-header.c
@@ -1140,7 +1140,7 @@ main (argc, argv)
if (entry->flags)
add_symbols (entry->flags, entry->names);
entry++;
- if (strcmp (entry->name, CONTINUED) != 0)
+ if (!entry->name || strcmp (entry->name, CONTINUED) != 0)
break;
}
}