From 6daa2d914b638ea400bc42a3e29a6d1cdf602ea1 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Wed, 19 Mar 2014 12:25:04 +0000 Subject: 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 --- gcc/ubsan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/ubsan.c') 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))); } -- cgit v1.1