OSDN Git Service

PR c/37529
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 16 Sep 2008 22:08:01 +0000 (22:08 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 16 Sep 2008 22:08:01 +0000 (22:08 +0000)
* gimplify.c (gimplify_expr) <case GOTO_EXPR>: If gimplification of
GOTO_DESTINATION failed, don't create GIMPLE_GOTO.

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140402 138bc75d-0d04-0410-961f-82ee72b054a4

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

index d5e0a1c..c4d91b6 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 81b21c5..bb38ba3 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 9c414a5..84d62d8 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" } */
+}