From: Roger Sayle Date: Sat, 11 Sep 2004 23:44:21 +0000 (+0000) Subject: re PR middle-end/17411 (ICE in immed_double_const) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ec76a0e0bf0a01edee001700b107a4772051d4ba;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 24b9efb8e7c..7316abd0135 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-09-11 Roger Sayle + + 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 * config/darwin.c (machopic_validate_stub_or_non_lazy_ptr): Mark diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e48d3015326..c47b9f8935a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-09-11 Roger Sayle + + PR middle-end/17411 + * g++.dg/opt/pr17411-1.C: New test case. + 2004-09-11 Joseph S. Myers * gcc.dg/declspec-4.c, gcc.dg/declspec-5.c, gcc.dg/declspec-6.c, diff --git a/gcc/testsuite/g++.dg/opt/pr17411-1.C b/gcc/testsuite/g++.dg/opt/pr17411-1.C new file mode 100644 index 00000000000..62b57a5a7f5 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr17411-1.C @@ -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())); +} + diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index b8ec2e1ff89..cde865ad285 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -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);