aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorSteven Bosscher <stevenb@suse.de>2004-09-11 19:48:58 +0000
committerSteven Bosscher <steven@gcc.gnu.org>2004-09-11 19:48:58 +0000
commit05cf561db41aa56f53e0c77b4489987f25fe2efa (patch)
treebb1962bfc50766eb7a19c562763e5c166da579bc /gcc/fold-const.c
parenta0be84dd8c0a461050ab96d8c563c9e9482e0107 (diff)
downloadgcc-05cf561db41aa56f53e0c77b4489987f25fe2efa.zip
gcc-05cf561db41aa56f53e0c77b4489987f25fe2efa.tar.gz
gcc-05cf561db41aa56f53e0c77b4489987f25fe2efa.tar.bz2
re PR c++/17412 (tree check failure in fold-const)
PR c++/17412 * fold-const.c (fold): Do not try to fold the operand of a CLEANUP_POINT_EXPR if that operand does itself not have any operands. testsuite/ * g++.dg/parse/break-in-for.C: New test. PR middle-end/17417 * langhooks.c (lhd_decl_printable_name): Make sure that this function is called with is a decl node that has an identifier. * tree-pretty-print.c (dump_function_name): New function to wrap PRINT_FUNCTION_NAME and dump_decl_name. (print_call_name): Use it. From-SVN: r87363
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index d0720e9..31bf7fd 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -8946,29 +8946,31 @@ fold (tree expr)
TREE_OPERAND (arg0, 1)))));
return t;
+ case CLEANUP_POINT_EXPR:
/* Pull arithmetic ops out of the CLEANUP_POINT_EXPR where
appropriate. */
- case CLEANUP_POINT_EXPR:
if (! has_cleanups (arg0))
return TREE_OPERAND (t, 0);
{
enum tree_code code0 = TREE_CODE (arg0);
int kind0 = TREE_CODE_CLASS (code0);
- tree arg00 = TREE_OPERAND (arg0, 0);
- tree arg01;
if (kind0 == '1' || code0 == TRUTH_NOT_EXPR)
- return fold (build1 (code0, type,
- fold (build1 (CLEANUP_POINT_EXPR,
- TREE_TYPE (arg00), arg00))));
+ {
+ tree arg00 = TREE_OPERAND (arg0, 0);
+ return fold (build1 (code0, type,
+ fold (build1 (CLEANUP_POINT_EXPR,
+ TREE_TYPE (arg00), arg00))));
+ }
if (kind0 == '<' || kind0 == '2'
|| code0 == TRUTH_ANDIF_EXPR || code0 == TRUTH_ORIF_EXPR
|| code0 == TRUTH_AND_EXPR || code0 == TRUTH_OR_EXPR
|| code0 == TRUTH_XOR_EXPR)
{
- arg01 = TREE_OPERAND (arg0, 1);
+ tree arg00 = TREE_OPERAND (arg0, 0);
+ tree arg01 = TREE_OPERAND (arg0, 1);
if (TREE_CONSTANT (arg00)
|| ((code0 == TRUTH_ANDIF_EXPR || code0 == TRUTH_ORIF_EXPR)