aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-10-25 14:24:28 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-10-25 14:24:28 -0400
commit14a3430e4f2c0266216d904b51c65d299abeb0c9 (patch)
tree5895a2df3e28a6de8edc59ef0ff6cc7b4434707f /gcc
parent0c59fd2fd22fa78fa357d6f509ac5e9be17316c1 (diff)
downloadgcc-14a3430e4f2c0266216d904b51c65d299abeb0c9.zip
gcc-14a3430e4f2c0266216d904b51c65d299abeb0c9.tar.gz
gcc-14a3430e4f2c0266216d904b51c65d299abeb0c9.tar.bz2
re PR c++/50866 (ICE in verify_gimple_stmt, at tree-cfg.c:4175)
PR c++/50866 PR c++/41449 * semantics.c (maybe_cleanup_point_expr_void): No longer static. * typeck2.c (split_nonconstant_init_1): Use it. * cp-tree.h: Declare it. * decl.c (wrap_cleanups_r): Stop at CLEANUP_POINT_EXPR. From-SVN: r180442
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/cp-tree.h1
-rw-r--r--gcc/cp/decl.c4
-rw-r--r--gcc/cp/semantics.c2
-rw-r--r--gcc/cp/typeck2.c1
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/g++.dg/init/aggr7.C13
7 files changed, 29 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 0586fe1..2ca141d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,12 @@
2011-10-25 Jason Merrill <jason@redhat.com>
+ PR c++/50866
+ PR c++/41449
+ * semantics.c (maybe_cleanup_point_expr_void): No longer static.
+ * typeck2.c (split_nonconstant_init_1): Use it.
+ * cp-tree.h: Declare it.
+ * decl.c (wrap_cleanups_r): Stop at CLEANUP_POINT_EXPR.
+
PR c++/49996
* tree.c (stabilize_init): Stabilize scalar elements of a
CONSTRUCTOR, too.
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index d0e874b..b20e7d1 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -5372,6 +5372,7 @@ extern int stmts_are_full_exprs_p (void);
extern void init_cp_semantics (void);
extern tree do_poplevel (tree);
extern void add_decl_expr (tree);
+extern tree maybe_cleanup_point_expr_void (tree);
extern tree finish_expr_stmt (tree);
extern tree begin_if_stmt (void);
extern void finish_if_stmt_cond (tree, tree);
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index a21cf46..26e9847 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -5718,7 +5718,9 @@ make_rtl_for_nonlocal_decl (tree decl, tree init, const char* asmspec)
static tree
wrap_cleanups_r (tree *stmt_p, int *walk_subtrees, void *data)
{
- if (TYPE_P (*stmt_p))
+ /* Stop at types or full-expression boundaries. */
+ if (TYPE_P (*stmt_p)
+ || TREE_CODE (*stmt_p) == CLEANUP_POINT_EXPR)
{
*walk_subtrees = 0;
return NULL_TREE;
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 42195be..84f112c 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -424,7 +424,7 @@ maybe_cleanup_point_expr (tree expr)
expression. The reason why we do this is because the original type might be
an aggregate and we cannot create a temporary variable for that type. */
-static tree
+tree
maybe_cleanup_point_expr_void (tree expr)
{
if (!processing_template_decl && stmts_are_full_exprs_p ())
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 0cb1104..57cd5e0 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -573,6 +573,7 @@ split_nonconstant_init_1 (tree dest, tree init)
code = build2 (INIT_EXPR, inner_type, sub, value);
code = build_stmt (input_location, EXPR_STMT, code);
+ code = maybe_cleanup_point_expr_void (code);
add_stmt (code);
if (!TYPE_HAS_TRIVIAL_DESTRUCTOR (inner_type))
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 7a82af0..2696fb6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2011-10-25 Jason Merrill <jason@redhat.com>
+ PR c++/50866
+ * g++.dg/init/aggr7.C: New.
+
PR c++/49996
* g++.dg/cpp0x/initlist59.C: New.
diff --git a/gcc/testsuite/g++.dg/init/aggr7.C b/gcc/testsuite/g++.dg/init/aggr7.C
new file mode 100644
index 0000000..bec952c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/aggr7.C
@@ -0,0 +1,13 @@
+// PR c++/50866
+
+struct A { A(); ~A(); };
+struct B { B(const char *, const A& = A()); ~B(); };
+struct C {
+ B b1, b2;
+};
+void f()
+{
+ C c = {
+ "a","b"
+ };
+}