From: Jakub Jelinek Date: Wed, 17 Jan 2018 21:08:36 +0000 (+0100) Subject: re PR c++/83897 (Useless __builtin_unreachable () emitted by the C++ FE) X-Git-Tag: upstream/12.2.0~33981 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=78a5fce0915a9077f814d05b05277c926032cffa;p=platform%2Fupstream%2Fgcc.git re PR c++/83897 (Useless __builtin_unreachable () emitted by the C++ FE) PR c++/83897 * cp-gimplify.c (cp_maybe_instrument_return): Handle CLEANUP_POINT_EXPR. * g++.dg/cpp0x/pr83897.C: New test. From-SVN: r256819 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 17b4192..0d73c5b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-01-17 Jakub Jelinek + + PR c++/83897 + * cp-gimplify.c (cp_maybe_instrument_return): Handle + CLEANUP_POINT_EXPR. + 2018-01-17 Paolo Carlini PR c++/81054 diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index e97247c..2185925 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -1581,6 +1581,7 @@ cp_maybe_instrument_return (tree fndecl) t = BIND_EXPR_BODY (t); continue; case TRY_FINALLY_EXPR: + case CLEANUP_POINT_EXPR: t = TREE_OPERAND (t, 0); continue; case STATEMENT_LIST: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fb0e919..96495d9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-01-17 Jakub Jelinek + + PR c++/83897 + * g++.dg/cpp0x/pr83897.C: New test. + 2018-01-17 Jan Hubicka PR ipa/83051 diff --git a/gcc/testsuite/g++.dg/cpp0x/pr83897.C b/gcc/testsuite/g++.dg/cpp0x/pr83897.C new file mode 100644 index 0000000..26a37d1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr83897.C @@ -0,0 +1,13 @@ +// PR c++/83897 +// { dg-do compile { target c++11 } } +// { dg-options "-O2 -fdump-tree-gimple" } +// { dg-final { scan-tree-dump-not "__builtin_unreachable" "gimple" } } + +struct A {}; +struct B { int a; int b = 5; }; + +A +bar (B) +{ + return {}; +}