Commit 6daa2d91 by Marek Polacek Committed by Marek Polacek

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
parent bd997277
2014-03-19 Marek Polacek <polacek@redhat.com>
PR sanitizer/60569
* ubsan.c (ubsan_type_descriptor): Check that DECL_NAME is nonnull
before accessing it.
2014-03-19 Richard Biener <rguenther@suse.de> 2014-03-19 Richard Biener <rguenther@suse.de>
PR lto/59543 PR lto/59543
......
2014-03-19 Marek Polacek <polacek@redhat.com>
PR sanitizer/60569
* g++.dg/ubsan/pr60569.C: New test.
2014-03-19 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> 2014-03-19 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* gcc.dg/tls/pr58595.c: Require tls_runtime instead of tls. * gcc.dg/tls/pr58595.c: Require tls_runtime instead of tls.
......
// PR sanitizer/60569
// { dg-do link }
// { dg-require-effective-target lto }
// { dg-options "-fsanitize=undefined -flto" }
struct A
{
void foo ();
struct
{
int i;
void bar () { i = 0; }
} s;
};
void A::foo () { s.bar (); }
int
main ()
{
}
...@@ -318,7 +318,7 @@ ubsan_type_descriptor (tree type, bool want_pointer_type_p) ...@@ -318,7 +318,7 @@ ubsan_type_descriptor (tree type, bool want_pointer_type_p)
{ {
if (TREE_CODE (TYPE_NAME (type2)) == IDENTIFIER_NODE) if (TREE_CODE (TYPE_NAME (type2)) == IDENTIFIER_NODE)
tname = IDENTIFIER_POINTER (TYPE_NAME (type2)); tname = IDENTIFIER_POINTER (TYPE_NAME (type2));
else else if (DECL_NAME (TYPE_NAME (type2)) != NULL)
tname = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type2))); tname = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type2)));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment