aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2008-04-09 12:15:53 -0400
committerJason Merrill <jason@gcc.gnu.org>2008-04-09 12:15:53 -0400
commitdf79488418903fda527f6a6b88e84b1f1d598526 (patch)
tree833422e84351b632443f3edcaf25f31398c9932b /gcc
parentee8f0bd7ae408c95d36edc5b7032104670b10c46 (diff)
downloadgcc-df79488418903fda527f6a6b88e84b1f1d598526.zip
gcc-df79488418903fda527f6a6b88e84b1f1d598526.tar.gz
gcc-df79488418903fda527f6a6b88e84b1f1d598526.tar.bz2
re PR c++/35708 (jump to label enters catch block)
PR c++/35708 * semantics.c (finish_compound_literal): Return a TARGET_EXPR, not a pushed variable. From-SVN: r134146
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/semantics.c31
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/ext/complit9.C15
4 files changed, 32 insertions, 25 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 17b09a7..1e13165 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2008-04-09 Jason Merrill <jason@redhat.com>
+
+ PR c++/35708
+ * semantics.c (finish_compound_literal): Return a TARGET_EXPR,
+ not a pushed variable.
+
2008-04-09 Volker Reichelt <v.reichelt@netcologne.de>
* call.c (build_op_delete_call): Fix quotation in warning message.
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 3a36fdd..12cf387 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -2101,7 +2101,6 @@ finish_unary_op_expr (enum tree_code code, tree expr)
tree
finish_compound_literal (tree type, VEC(constructor_elt,gc) *initializer_list)
{
- tree var;
tree compound_literal;
if (!TYPE_OBJ_P (type))
@@ -2120,30 +2119,12 @@ finish_compound_literal (tree type, VEC(constructor_elt,gc) *initializer_list)
return compound_literal;
}
- /* Create a temporary variable to represent the compound literal. */
- var = create_temporary_var (type);
- if (!current_function_decl)
- {
- /* If this compound-literal appears outside of a function, then
- the corresponding variable has static storage duration, just
- like the variable in whose initializer it appears. */
- TREE_STATIC (var) = 1;
- /* The variable has internal linkage, since there is no need to
- reference it from another translation unit. */
- TREE_PUBLIC (var) = 0;
- /* It must have a name, so that the name mangler can mangle it. */
- DECL_NAME (var) = make_anon_name ();
- }
- /* We must call pushdecl, since the gimplifier complains if the
- variable has not been declared via a BIND_EXPR. */
- pushdecl (var);
- /* Initialize the variable as we would any other variable with a
- brace-enclosed initializer. */
- cp_finish_decl (var, compound_literal,
- /*init_const_expr_p=*/false,
- /*asmspec_tree=*/NULL_TREE,
- LOOKUP_ONLYCONVERTING);
- return var;
+ type = complete_type (type);
+ compound_literal = reshape_init (type, compound_literal);
+ if (TREE_CODE (type) == ARRAY_TYPE)
+ cp_complete_array_type (&type, compound_literal, false);
+ compound_literal = digest_init (type, compound_literal);
+ return get_target_expr (compound_literal);
}
/* Return the declaration for the function-name variable indicated by
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 18d9236..3e091a4 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2008-04-09 Jason Merrill <jason@redhat.com>
+
+ PR c++/35708
+ * g++.dg/ext/complit9.C: New.
+
2008-04-09 Samuel Tardieu <sam@rfc1149.net>
PR ada/28305
diff --git a/gcc/testsuite/g++.dg/ext/complit9.C b/gcc/testsuite/g++.dg/ext/complit9.C
new file mode 100644
index 0000000..5b7fbe7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/complit9.C
@@ -0,0 +1,15 @@
+// PR c++/35708
+// { dg-options "" }
+
+struct object { int one_o; int allocstamp; };
+int pgci_pointable (object obj);
+void foo(void);
+int main (int argc, char *argv[])
+{
+ if (pgci_pointable((object){7,100}))
+ {
+ bad_rehash_size:
+ foo();
+ }
+ goto bad_rehash_size;
+}