Commit 875bcfdb by Jason Merrill Committed by Jason Merrill

re PR c++/50793 (G++ doesn't value-initialize all members of non-trivial type in default argument)

	PR c++/50793
	* tree.c (bot_manip): Propagate AGGR_INIT_ZERO_FIRST.

From-SVN: r180227
parent f33fa066
2011-10-19 Jason Merrill <jason@redhat.com>
PR c++/50793
* tree.c (bot_manip): Propagate AGGR_INIT_ZERO_FIRST.
2011-10-19 Roland Stigge <stigge@antcom.de> 2011-10-19 Roland Stigge <stigge@antcom.de>
PR translation/49704 PR translation/49704
......
...@@ -1879,8 +1879,12 @@ bot_manip (tree* tp, int* walk_subtrees, void* data) ...@@ -1879,8 +1879,12 @@ bot_manip (tree* tp, int* walk_subtrees, void* data)
tree u; tree u;
if (TREE_CODE (TREE_OPERAND (t, 1)) == AGGR_INIT_EXPR) if (TREE_CODE (TREE_OPERAND (t, 1)) == AGGR_INIT_EXPR)
u = build_cplus_new (TREE_TYPE (t), TREE_OPERAND (t, 1), {
tf_warning_or_error); u = build_cplus_new (TREE_TYPE (t), TREE_OPERAND (t, 1),
tf_warning_or_error);
if (AGGR_INIT_ZERO_FIRST (TREE_OPERAND (t, 1)))
AGGR_INIT_ZERO_FIRST (TREE_OPERAND (u, 1)) = true;
}
else else
u = build_target_expr_with_type (TREE_OPERAND (t, 1), TREE_TYPE (t), u = build_target_expr_with_type (TREE_OPERAND (t, 1), TREE_TYPE (t),
tf_warning_or_error); tf_warning_or_error);
......
2011-10-19 Jason Merrill <jason@redhat.com>
PR c++/50793
* g++.dg/init/value9.C: New.
2011-10-19 Jakub Jelinek <jakub@redhat.com> 2011-10-19 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/torture/vshuf-32.inc: Add interleave permutations. * gcc.dg/torture/vshuf-32.inc: Add interleave permutations.
......
// PR c++/50793
// { dg-do run }
struct NonTrivial
{
NonTrivial() { }
};
struct S
{
NonTrivial nt;
int i;
};
int f(S s)
{
s.i = 0xdeadbeef;
return s.i;
}
int g(S s = S())
{
return s.i;
}
int main()
{
f(S()); // make stack dirty
if ( g() )
__builtin_abort();
}
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