]> 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 21:51:57 +0000 (23:51 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 7 Jul 2016 21:51:57 +0000 (23:51 +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: r238143

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

index 1dbd3df30629af3e632899eb4855687bb594ccba..c8db5319f4e4e01dbc37de96033193b4193765fb 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-03-29  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/70429
index 888311c89cf006a83bbf1aa7616ac0babb78524a..5a7410725aadf866a48c5a4b5e4d036755298acb 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-03-29  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/70429
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 28753c16c897483335e896cc19a287dfed1267e6..5efbbc52695c4a2418dde98351498c824b813689 100644 (file)
@@ -1313,7 +1313,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;