From: Jakub Jelinek Date: Tue, 16 Sep 2008 22:08:01 +0000 (+0200) Subject: re PR c/37529 (ICE with invalid goto) X-Git-Tag: releases/gcc-4.4.0~2418 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8c50b4950276e667112e1999018ab792a9e24134;p=thirdparty%2Fgcc.git re PR c/37529 (ICE with invalid goto) PR c/37529 * gimplify.c (gimplify_expr) : If gimplification of GOTO_DESTINATION failed, don't create GIMPLE_GOTO. * gcc.dg/pr37529.c: New test. From-SVN: r140402 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d5e0a1c67da3..c4d91b6c901f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2008-09-16 Jakub Jelinek + PR c/37529 + * gimplify.c (gimplify_expr) : If gimplification of + GOTO_DESTINATION failed, don't create GIMPLE_GOTO. + PR c++/37530 * gimplify.c (gimplify_expr) : Don't create GIMPLE_TRY if cleanup sequence is empty. diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 81b21c5fa66f..bb38ba398f63 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 9c414a556f3b..84d62d873e31 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2008-09-16 Jakub Jelinek + 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 000000000000..87361d5c818e --- /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" } */ +}