re PR middle-end/17411 (ICE in immed_double_const)

PR middle-end/17411
	* tree-sra.c (generate_element_zero): Revert recent build_int_cst
	change. elt->type may be a floating point type, so use fold_convert.

	* g++.dg/opt/pr17411-1.C: New test case.

From-SVN: r87377
This commit is contained in:
Roger Sayle 2004-09-11 23:44:21 +00:00 committed by Roger Sayle
parent d6a1dfd98b
commit ec76a0e0bf
4 changed files with 33 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2004-09-11 Roger Sayle <roger@eyesopen.com>
PR middle-end/17411
* tree-sra.c (generate_element_zero): Revert recent build_int_cst
change. elt->type may be a floating point type, so use fold_convert.
2004-09-11 Geoffrey Keating <geoffk@apple.com>
* config/darwin.c (machopic_validate_stub_or_non_lazy_ptr): Mark

View File

@ -1,3 +1,8 @@
2004-09-11 Roger Sayle <roger@eyesopen.com>
PR middle-end/17411
* g++.dg/opt/pr17411-1.C: New test case.
2004-09-11 Joseph S. Myers <jsm@polyomino.org.uk>
* gcc.dg/declspec-4.c, gcc.dg/declspec-5.c, gcc.dg/declspec-6.c,

View File

@ -0,0 +1,21 @@
// PR middle-end/17411
// { dg-do compile }
// { dg-options "-O2" }
struct CalibData {
float mean_pedestal;
};
struct pair
{
CalibData second;
pair(const CalibData& __b) : second(__b) { }
};
void insert(const pair& __x);
void foo()
{
insert(pair(CalibData()));
}

View File

@ -1534,7 +1534,7 @@ generate_element_zero (struct sra_elt *elt, tree *list_p)
tree t;
gcc_assert (elt->is_scalar);
t = build_int_cst (elt->type, 0);
t = fold_convert (elt->type, integer_zero_node);
t = build (MODIFY_EXPR, void_type_node, elt->replacement, t);
append_to_statement_list (t, list_p);