re PR c++/83897 (Useless __builtin_unreachable () emitted by the C++ FE)
authorJakub Jelinek <jakub@redhat.com>
Wed, 17 Jan 2018 21:08:36 +0000 (22:08 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 17 Jan 2018 21:08:36 +0000 (22:08 +0100)
PR c++/83897
* cp-gimplify.c (cp_maybe_instrument_return): Handle
CLEANUP_POINT_EXPR.

* g++.dg/cpp0x/pr83897.C: New test.

From-SVN: r256819

gcc/cp/ChangeLog
gcc/cp/cp-gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/pr83897.C [new file with mode: 0644]

index 17b41921db93e66e6fb050ea4fdf99dc16b02f51..0d73c5b0f4a143707072f61ba3dbe55d80155c05 100644 (file)
@@ -1,3 +1,9 @@
+2018-01-17  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/83897
+       * cp-gimplify.c (cp_maybe_instrument_return): Handle
+       CLEANUP_POINT_EXPR.
+
 2018-01-17  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/81054
index e97247c13843aba91591626f977288b45af6dc17..21859251795bb82fd875d7f10b674d41694e38e1 100644 (file)
@@ -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:
index fb0e919913f9d4ce823d57238b67a941bba21845..96495d9f7c6f6cdafa7ed4d880ef2211727502ab 100644 (file)
@@ -1,3 +1,8 @@
+2018-01-17  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/83897
+       * g++.dg/cpp0x/pr83897.C: New test.
+
 2018-01-17  Jan Hubicka  <hubicka@ucw.cz>
 
        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 (file)
index 0000000..26a37d1
--- /dev/null
@@ -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 {};
+}