From: Jakub Jelinek Date: Thu, 12 Feb 2015 15:38:33 +0000 (+0100) Subject: re PR sanitizer/64984 (ICE in check_noexcept_t with ubsan) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=40595b8e01bd43d5c58b5fbf0abed1f30419aed3;p=gcc.git re PR sanitizer/64984 (ICE in check_noexcept_t with ubsan) PR sanitizer/64984 * except.c (check_noexcept_r): Return NULL for internal calls. * g++.dg/ubsan/pr64984.C: New test. From-SVN: r220649 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 73d1b931fb1..b66231d2feb 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2015-02-12 Jakub Jelinek + + PR sanitizer/64984 + * except.c (check_noexcept_r): Return NULL for internal + calls. + 2015-02-10 Jason Merrill PR c++/64994 diff --git a/gcc/cp/except.c b/gcc/cp/except.c index 6aff7b59439..3ff1ce607ee 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -1148,7 +1148,7 @@ check_noexcept_r (tree *tp, int * /*walk_subtrees*/, void * /*data*/) { tree t = *tp; enum tree_code code = TREE_CODE (t); - if (code == CALL_EXPR + if ((code == CALL_EXPR && CALL_EXPR_FN (t)) || code == AGGR_INIT_EXPR) { /* We can only use the exception specification of the called function diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 51e65ca41a0..276d6e17d4e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-02-12 Jakub Jelinek + + PR sanitizer/64984 + * g++.dg/ubsan/pr64984.C: New test. + 2015-02-12 James Greenhalgh * gfortran.dg/pr45636.f90: XFAIL for aarch64* targets. diff --git a/gcc/testsuite/g++.dg/ubsan/pr64984.C b/gcc/testsuite/g++.dg/ubsan/pr64984.C new file mode 100644 index 00000000000..34f8926cc5d --- /dev/null +++ b/gcc/testsuite/g++.dg/ubsan/pr64984.C @@ -0,0 +1,76 @@ +// PR sanitizer/64984 +// { dg-do compile } +// { dg-options "-fsanitize=vptr -std=gnu++11" } + +template struct K +{ + static constexpr X v = 0; + typedef K t; +}; +template struct A; +template +struct A : Y +{ +}; +template X M (); +template struct B; +template +struct B : K(M()))> +{ +}; +template +struct G : A>::t +{ +}; +template struct J : G +{ +}; +template X&& foo (X&); +template X&& bar (X&&); +template struct P +{ + P (X& x) : q (x) {} + X q; +}; +template struct Q; +template +struct Q : P +{ + typedef P r; + X& s (Q&); + Q (X& x) : r (x) {} + Q (Q&& x) noexcept (J::v) : r (foo(s (x))) + { + } +}; +template struct I : Q +{ + I (); + I (X&... x) : Q(x...) + { + } +}; +template +I baz (X&&... x) +{ + return I (foo(x)...); +} +template struct F +{ + int p; + void operator[] (X&& x) + { + baz (bar (x)); + } +}; +struct U +{ + virtual ~U (); +}; + +int +main () +{ + F m; + m[U ()]; +}