aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2013-09-25 09:04:20 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2013-09-25 09:04:20 +0000
commitd70b0f1f2212a900b8547b288a7c3d2ae89ac267 (patch)
tree38ec26258c9aa12e84aa51c4a0491891d8c94ffb
parentb56e978833b09ba47ebc4ebdace007164b493266 (diff)
downloadgcc-d70b0f1f2212a900b8547b288a7c3d2ae89ac267.zip
gcc-d70b0f1f2212a900b8547b288a7c3d2ae89ac267.tar.gz
gcc-d70b0f1f2212a900b8547b288a7c3d2ae89ac267.tar.bz2
re PR sanitizer/58420 (internal compiler error: in ubsan_type_descriptor, at ubsan.c:280)
PR sanitizer/58420 * ubsan.c (ubsan_type_descriptor): Handle IDENTIFIER_NODEs when determining the type name. From-SVN: r202887
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/ubsan.c11
2 files changed, 15 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4b003a5..e6f2b9e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/ubsan.c b/gcc/ubsan.c
index 6c6fea8..9dc19c9 100644
--- a/gcc/ubsan.c
+++ b/gcc/ubsan.c
@@ -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. */