aboutsummaryrefslogtreecommitdiff
path: root/gcc/ubsan.c
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2014-03-19 12:25:04 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2014-03-19 12:25:04 +0000
commit6daa2d914b638ea400bc42a3e29a6d1cdf602ea1 (patch)
tree796c13eb2bc2bb780bf167d29b9e9996dfe83e67 /gcc/ubsan.c
parentbd9972776107a0e19931603863a2a342d1c7220b (diff)
downloadgcc-6daa2d914b638ea400bc42a3e29a6d1cdf602ea1.zip
gcc-6daa2d914b638ea400bc42a3e29a6d1cdf602ea1.tar.gz
gcc-6daa2d914b638ea400bc42a3e29a6d1cdf602ea1.tar.bz2
re PR sanitizer/60569 (Segfault with -flto and -fsanitize=undefined)
PR sanitizer/60569 * ubsan.c (ubsan_type_descriptor): Check that DECL_NAME is nonnull before accessing it. testsuite/ * g++.dg/ubsan/pr60569.C: New test. From-SVN: r208681
Diffstat (limited to 'gcc/ubsan.c')
-rw-r--r--gcc/ubsan.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/ubsan.c b/gcc/ubsan.c
index 7c7a893..22470da 100644
--- a/gcc/ubsan.c
+++ b/gcc/ubsan.c
@@ -318,7 +318,7 @@ ubsan_type_descriptor (tree type, bool want_pointer_type_p)
{
if (TREE_CODE (TYPE_NAME (type2)) == IDENTIFIER_NODE)
tname = IDENTIFIER_POINTER (TYPE_NAME (type2));
- else
+ else if (DECL_NAME (TYPE_NAME (type2)) != NULL)
tname = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type2)));
}