diff options
author | Andrew Pinski <pinskia@physics.uc.edu> | 2004-10-11 03:42:09 +0000 |
---|---|---|
committer | Andrew Pinski <pinskia@gcc.gnu.org> | 2004-10-10 20:42:09 -0700 |
commit | 0ad28ddea6a397689d8d03e4eb165312b7487655 (patch) | |
tree | ba27ac02d6df5a9d734fba44b00edb8f74204304 /gcc/cp/semantics.c | |
parent | 5c70192c1d006b8ca0f028aea3e88f0964f7b8b8 (diff) | |
download | gcc-0ad28ddea6a397689d8d03e4eb165312b7487655.zip gcc-0ad28ddea6a397689d8d03e4eb165312b7487655.tar.gz gcc-0ad28ddea6a397689d8d03e4eb165312b7487655.tar.bz2 |
re PR c++/17554 (crashes in on kopete build (KDE's kdenetwork))
2004-10-10 Andrew Pinski <pinskia@physics.uc.edu>
PR c++/17554
part of c++/17657
middle-end/17703
* semantics.c (maybe_cleanup_point_expr): Call
fold_build_cleanup_point_expr.
(maybe_cleanup_point_expr_void): New function.
(add_decl_expr): Call maybe_cleanup_point_expr_void.
(finish_expr_stmt): Likewise.
(finish_return_stmt): Likewise.
(finish_for_expr): Likewise.
(finish_asm_stmt): Likewise.
* typeck.c (condition_conversion): Call
fold_build_cleanup_point_expr.
2004-10-10 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/17703
part of PR c++/17657
* fold-const.c (fold_build_cleanup_point_expr): New function.
* tree.h (fold_build_cleanup_point_expr): Prototype.
2004-10-10 Andrew Pinski <pinskia@physics.uc.edu>
PR c++/17554
* g++.dg/init/for3.C: New test.
PR c++/17657
* g++.dg/opt/switch2.C: New test.
PR middle-end/17703
* g++.dg/warn/Wreturn-2.C: New test.
From-SVN: r88869
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r-- | gcc/cp/semantics.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 45912c1..0fb5c68 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -358,10 +358,25 @@ static tree maybe_cleanup_point_expr (tree expr) { if (!processing_template_decl && stmts_are_full_exprs_p ()) - expr = build1 (CLEANUP_POINT_EXPR, TREE_TYPE (expr), expr); + expr = fold_build_cleanup_point_expr (TREE_TYPE (expr), expr); return expr; } +/* Like maybe_cleanup_point_expr except have the type of the new expression be + void so we don't need to create a temprary variable to hold the inner + expression. The reason why we do this is because the orginal type might be + an aggregate and we cannot create a temprary variable for that type. */ + +static tree +maybe_cleanup_point_expr_void (tree expr) +{ + if (!processing_template_decl && stmts_are_full_exprs_p ()) + expr = fold_build_cleanup_point_expr (void_type_node, expr); + return expr; +} + + + /* Create a declaration statement for the declaration given by the DECL. */ void @@ -370,7 +385,7 @@ add_decl_expr (tree decl) tree r = build_stmt (DECL_EXPR, decl); if (DECL_INITIAL (decl) || (DECL_SIZE (decl) && TREE_SIDE_EFFECTS (DECL_SIZE (decl)))) - r = maybe_cleanup_point_expr (r); + r = maybe_cleanup_point_expr_void (r); add_stmt (r); } @@ -556,7 +571,7 @@ finish_expr_stmt (tree expr) { if (TREE_CODE (expr) != EXPR_STMT) expr = build_stmt (EXPR_STMT, expr); - expr = maybe_cleanup_point_expr (expr); + expr = maybe_cleanup_point_expr_void (expr); } r = add_stmt (expr); @@ -719,7 +734,7 @@ finish_return_stmt (tree expr) } r = build_stmt (RETURN_EXPR, expr); - r = maybe_cleanup_point_expr (r); + r = maybe_cleanup_point_expr_void (r); r = add_stmt (r); finish_stmt (); @@ -783,7 +798,7 @@ finish_for_expr (tree expr, tree for_stmt) cxx_incomplete_type_error (expr, TREE_TYPE (expr)); expr = error_mark_node; } - expr = maybe_cleanup_point_expr (expr); + expr = maybe_cleanup_point_expr_void (expr); FOR_EXPR (for_stmt) = expr; } @@ -1179,7 +1194,7 @@ finish_asm_stmt (int volatile_p, tree string, tree output_operands, output_operands, input_operands, clobbers); ASM_VOLATILE_P (r) = volatile_p; - r = maybe_cleanup_point_expr (r); + r = maybe_cleanup_point_expr_void (r); return add_stmt (r); } |