]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c/37529 (ICE with invalid goto)
authorJakub Jelinek <jakub@redhat.com>
Tue, 16 Sep 2008 22:08:01 +0000 (00:08 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 16 Sep 2008 22:08:01 +0000 (00:08 +0200)
PR c/37529
* gimplify.c (gimplify_expr) <case GOTO_EXPR>: If gimplification of
GOTO_DESTINATION failed, don't create GIMPLE_GOTO.

* gcc.dg/pr37529.c: New test.

From-SVN: r140402

gcc/ChangeLog
gcc/gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr37529.c [new file with mode: 0644]

index d5e0a1c67da31161bfd0dcbf262247cb2d7f2f65..c4d91b6c901fa261f0c838265f157be88bff39e5 100644 (file)
@@ -1,5 +1,9 @@
 2008-09-16  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c/37529
+       * gimplify.c (gimplify_expr) <case GOTO_EXPR>: If gimplification of
+       GOTO_DESTINATION failed, don't create GIMPLE_GOTO.
+
        PR c++/37530
        * gimplify.c (gimplify_expr) <case TRY_CATCH_EXPR>: Don't create
        GIMPLE_TRY if cleanup sequence is empty.
index 81b21c5fa66f1003cec95ed60c3ce6c47ad8520c..bb38ba398f63b508635bd411de96236db469bb38 100644 (file)
@@ -6483,8 +6483,12 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
          /* If the target is not LABEL, then it is a computed jump
             and the target needs to be gimplified.  */
          if (TREE_CODE (GOTO_DESTINATION (*expr_p)) != LABEL_DECL)
-           ret = gimplify_expr (&GOTO_DESTINATION (*expr_p), pre_p,
-                                NULL, is_gimple_val, fb_rvalue);
+           {
+             ret = gimplify_expr (&GOTO_DESTINATION (*expr_p), pre_p,
+                                  NULL, is_gimple_val, fb_rvalue);
+             if (ret == GS_ERROR)
+               break;
+           }
          gimplify_seq_add_stmt (pre_p,
                          gimple_build_goto (GOTO_DESTINATION (*expr_p)));
          break;
index 9c414a556f3bbab1d40de7b23620a0b61aff4161..84d62d873e3146257ce649b3532cc74e316383c2 100644 (file)
@@ -1,5 +1,8 @@
 2008-09-16  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c/37529
+       * gcc.dg/pr37529.c: New test.
+
        PR c++/37530
        * g++.dg/parse/crash48.C: New test.
 
diff --git a/gcc/testsuite/gcc.dg/pr37529.c b/gcc/testsuite/gcc.dg/pr37529.c
new file mode 100644 (file)
index 0000000..87361d5
--- /dev/null
@@ -0,0 +1,9 @@
+/* PR c/37529 */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu89" } */
+
+void
+foo ()
+{
+  goto *;      /* { dg-error "expected expression before" } */
+}