]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorJeffrey A Law <law@cygnus.com>
Tue, 7 Sep 1999 08:11:16 +0000 (08:11 +0000)
committerJeff Law <law@gcc.gnu.org>
Tue, 7 Sep 1999 08:11:16 +0000 (02:11 -0600)
        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.

From-SVN: r29161

gcc/ChangeLog
gcc/c-common.c
gcc/fix-header.c

index 643ee002945c6548221ac104d8ecdcbb083dd147..d86ae8162dfbcac5a0357d7941265e8459fd8250 100644 (file)
@@ -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,
index 0c201fbe58ee5818065a953f7bb31d554764a67a..59dd407758de819bf4f20deb54f80375b7a965d0 100644 (file)
@@ -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);
 }
index af0577e43c469d13ea2803cf00e771eb6d80268b..1e6c5c47b8a9809625218440d1c7e7aa1eb81da8 100644 (file)
@@ -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;
        }
     }