aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2008-09-17 00:08:01 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2008-09-17 00:08:01 +0200
commit8c50b4950276e667112e1999018ab792a9e24134 (patch)
tree1fe1f03500d1e925cfdab311883d9cd8a69c4e11 /gcc
parentcc8b343d265200a3bd9fa1eccfa2db35499cb5c7 (diff)
downloadgcc-8c50b4950276e667112e1999018ab792a9e24134.zip
gcc-8c50b4950276e667112e1999018ab792a9e24134.tar.gz
gcc-8c50b4950276e667112e1999018ab792a9e24134.tar.bz2
re PR c/37529 (ICE with invalid goto)
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/gimplify.c8
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/gcc.dg/pr37529.c9
4 files changed, 22 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d5e0a1c6..c4d91b6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 81b21c5..bb38ba3 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -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;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 9c414a5..84d62d8 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..87361d5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr37529.c
@@ -0,0 +1,9 @@
+/* PR c/37529 */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu89" } */
+
+void
+foo ()
+{
+ goto *; /* { dg-error "expected expression before" } */
+}