]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR sanitizer/58420 (internal compiler error: in ubsan_type_descriptor, at ubsan...
authorMarek Polacek <polacek@redhat.com>
Wed, 25 Sep 2013 09:04:20 +0000 (09:04 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Wed, 25 Sep 2013 09:04:20 +0000 (09:04 +0000)
PR sanitizer/58420
* ubsan.c (ubsan_type_descriptor): Handle IDENTIFIER_NODEs
when determining the type name.

From-SVN: r202887

gcc/ChangeLog
gcc/ubsan.c

index 4b003a51669ea95165c25d31fd6adb3b44da7b26..e6f2b9ea8fd77d5861cf5ba3bce2a68f4925e48d 100644 (file)
@@ -1,3 +1,9 @@
+2013-09-25  Marek Polacek  <polacek@redhat.com>
+
+       PR sanitizer/58420
+       * ubsan.c (ubsan_type_descriptor): Handle IDENTIFIER_NODEs
+       when determining the type name.
+
 2013-09-24  Oleg Endo  <olegendo@gcc.gnu.org>
 
        * config/sh/sh.md: Fix formatting.
index 6c6fea80afd3e0fb7f036a7b12e467c337acea45..9dc19c9d29add73ab8d44e5ff5fa6539fefbddc8 100644 (file)
@@ -259,11 +259,18 @@ ubsan_type_descriptor (tree type)
   unsigned short tkind, tinfo;
 
   /* At least for INTEGER_TYPE/REAL_TYPE/COMPLEX_TYPE, this should work.
-     ??? For e.g. type_unsigned_for (type), the TYPE_NAME would be NULL.  */
+     For e.g. type_unsigned_for (type) or bit-fields, the TYPE_NAME
+     would be NULL.  */
   if (TYPE_NAME (type) != NULL)
-    tname = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
+    {
+      if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
+       tname = IDENTIFIER_POINTER (TYPE_NAME (type));
+      else
+       tname = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
+    }
   else
     tname = "<unknown>";
+
   if (TREE_CODE (type) == INTEGER_TYPE)
     {
       /* For INTEGER_TYPE, this is 0x0000.  */