re PR c++/53812 (lower_stmt (4.6), verify_gimple_stmt (4.7.0, 4.7.1))
authorJakub Jelinek <jakub@redhat.com>
Tue, 3 Jul 2012 13:09:16 +0000 (15:09 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 3 Jul 2012 13:09:16 +0000 (15:09 +0200)
PR c++/53812
* semantics.c (finish_goto_stmt): Surround computed goto argument
with CLEANUP_POINT_EXPR if needed.

* g++.dg/ext/label14.C: New test.

From-SVN: r189225

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/label14.C [new file with mode: 0644]

index 2c524230fe43260f6f8a6a7602628ce65601c97a..0b3adaf7391bb266c642f79d3c685f48b8b8a750 100644 (file)
@@ -1,3 +1,9 @@
+2012-07-03  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/53812
+       * semantics.c (finish_goto_stmt): Surround computed goto argument
+       with CLEANUP_POINT_EXPR if needed.
+
 2012-07-02  Jason Merrill  <jason@redhat.com>
 
        PR c++/53619
index 8e37ebb7e162eda1e954ef6c92c9e4da41baffe0..0cacf7494798f466e633b0f1725238dfffb1384c 100644 (file)
@@ -571,6 +571,9 @@ finish_goto_stmt (tree destination)
                                    tf_warning_or_error);
          if (error_operand_p (destination))
            return NULL_TREE;
+         destination
+           = fold_build_cleanup_point_expr (TREE_TYPE (destination),
+                                            destination);
        }
     }
 
index 3d51a0c574fa18447837bd8b7c7dcb8de7a04232..42366fa0ecb8814fbcd536625db8a7a3889e3f0d 100644 (file)
@@ -1,3 +1,8 @@
+2012-07-03  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/53812
+       * g++.dg/ext/label14.C: New test.
+
 2012-07-03  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/53811
diff --git a/gcc/testsuite/g++.dg/ext/label14.C b/gcc/testsuite/g++.dg/ext/label14.C
new file mode 100644 (file)
index 0000000..d1a8b0d
--- /dev/null
@@ -0,0 +1,17 @@
+// PR c++/53812
+// { dg-do compile }
+// { dg-options "" }
+
+struct T { T () : t(0) {}; int t; ~T (); };
+struct S { void *operator [] (T); };
+void bar (S &, void *, void *);
+
+void
+foo (S &x, T &y)
+{
+  bar (x, &&l1, &&l2);
+l1:
+  goto *x[y];
+l2:
+  bar (x, &&l1, &&l2);
+}