]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR middle-end/71494 (label as value in nested function)
authorJakub Jelinek <jakub@redhat.com>
Thu, 7 Jul 2016 12:43:50 +0000 (14:43 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 7 Jul 2016 12:43:50 +0000 (14:43 +0200)
Backported from mainline
2016-06-10  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/71494
* tree-nested.c (convert_nonlocal_reference_stmt): For GIMPLE_GOTO
without LABEL_DECL, set *handled_ops_p to false instead of true.

* gcc.c-torture/execute/pr71494.c: New test.

From-SVN: r238096

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/pr71494.c [new file with mode: 0644]
gcc/tree-nested.c

index f1eb6d0f14f268d8e1c1cbe1df85adb541aa04d8..c4ee0ef9ed1a5d5398c97e79b58acb88b38c5a92 100644 (file)
@@ -1,6 +1,12 @@
 2016-07-07  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2016-06-10  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/71494
+       * tree-nested.c (convert_nonlocal_reference_stmt): For GIMPLE_GOTO
+       without LABEL_DECL, set *handled_ops_p to false instead of true.
+
        2016-04-13  Jakub Jelinek  <jakub@redhat.com>
  
        PR c++/70641
index 0a61ba67fe0448215191c8c435979fea9d902dc7..113f180c33c056254f594b6f93965bd2240f4a96 100644 (file)
@@ -1,6 +1,11 @@
 2016-07-07  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2016-06-10  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/71494
+       * gcc.c-torture/execute/pr71494.c: New test.
+
        2016-06-13  Jakub Jelinek  <jakub@redhat.com>
 
        PR sanitizer/71498
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr71494.c b/gcc/testsuite/gcc.c-torture/execute/pr71494.c
new file mode 100644 (file)
index 0000000..f962f2c
--- /dev/null
@@ -0,0 +1,22 @@
+/* PR middle-end/71494 */
+
+int
+main ()
+{
+  void *label = &&out;
+  int i = 0;
+  void test (void)
+  {
+    label = &&out2;
+    goto *label;
+   out2:;
+    i++;
+  }
+  goto *label;
+ out:
+  i += 2;
+  test ();
+  if (i != 3)
+    __builtin_abort ();
+  return 0;
+}
index 4991219c19bfffcae55beb4ea48faa4136f21589..4be86682d04c4d76f40b4dd7c04e57577c4208eb 100644 (file)
@@ -1344,7 +1344,7 @@ convert_nonlocal_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
        {
          wi->val_only = true;
          wi->is_lhs = false;
-         *handled_ops_p = true;
+         *handled_ops_p = false;
          return NULL_TREE;
        }
       break;