Commit 0a2cdfe6 by Jason Merrill Committed by Jason Merrill

re PR c++/48834 (-fno-exceptions causes wrong code generation on C++ code)

	PR c++/48834
	* tree.c (build_vec_init_expr): Set TREE_SIDE_EFFECTS.
	Protect an explicit target.

From-SVN: r173272
parent 2609a0ce
2011-05-02 Jason Merrill <jason@redhat.com> 2011-05-02 Jason Merrill <jason@redhat.com>
PR c++/48834
* tree.c (build_vec_init_expr): Set TREE_SIDE_EFFECTS.
Protect an explicit target.
PR c++/48446 PR c++/48446
* decl.c (stabilize_save_expr_r, stabilize_vla_size): New. * decl.c (stabilize_save_expr_r, stabilize_vla_size): New.
(compute_array_index_type): Revert earlier 48446 changes. (compute_array_index_type): Revert earlier 48446 changes.
......
...@@ -564,6 +564,7 @@ build_vec_init_expr (tree target, tree init, tree nelts, ...@@ -564,6 +564,7 @@ build_vec_init_expr (tree target, tree init, tree nelts,
elt_init = build_vec_init_elt (type, init, complain); elt_init = build_vec_init_elt (type, init, complain);
init = build3 (VEC_INIT_EXPR, type, slot, init, nelts); init = build3 (VEC_INIT_EXPR, type, slot, init, nelts);
TREE_SIDE_EFFECTS (init) = true;
SET_EXPR_LOCATION (init, input_location); SET_EXPR_LOCATION (init, input_location);
if (cxx_dialect >= cxx0x if (cxx_dialect >= cxx0x
...@@ -571,7 +572,11 @@ build_vec_init_expr (tree target, tree init, tree nelts, ...@@ -571,7 +572,11 @@ build_vec_init_expr (tree target, tree init, tree nelts,
VEC_INIT_EXPR_IS_CONSTEXPR (init) = true; VEC_INIT_EXPR_IS_CONSTEXPR (init) = true;
VEC_INIT_EXPR_VALUE_INIT (init) = value_init; VEC_INIT_EXPR_VALUE_INIT (init) = value_init;
if (slot != target) if (slot == target)
/* If we specified what array we're initializing, make sure
we don't override that in cp_gimplify_init_expr. */
init = cp_build_compound_expr (init, slot, complain);
else
{ {
init = build_target_expr (slot, init, complain); init = build_target_expr (slot, init, complain);
TARGET_EXPR_IMPLICIT_P (init) = 1; TARGET_EXPR_IMPLICIT_P (init) = 1;
......
2011-05-02 Jason Merrill <jason@redhat.com>
* g++.dg/init/new31.C: New.
2011-05-02 Simon Martin <simartin@users.sourceforge.net> 2011-05-02 Simon Martin <simartin@users.sourceforge.net>
PR c/35445 PR c/35445
......
// PR c++/48834
// { dg-options -Wuninitialized }
// { dg-do run }
struct S
{
S ():i (0)
{
}
int i;
};
int
main ()
{
S *s = new S[2];
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment