From: Andrew Pinski Date: Fri, 13 Jan 2006 14:30:08 +0000 (+0000) Subject: re PR tree-optimization/24365 (statement makes a memory store with complex) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=22918034f8e5ff75c20da27f988301b23a531975;p=gcc.git re PR tree-optimization/24365 (statement makes a memory store with complex) 2006-01-13 Andrew Pinski PR tree-opt/24365 * tree-inline.c (declare_return_variable): If the return variable was marked as a non gimple complex, set the return slot variable to be a non gimple comple variable. 2006-01-13 Andrew Pinski PR tree-opt/24365 * g++.dg/opt/complex5.C: New test. From-SVN: r109667 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 29510559ded..42e8a7a5ab2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2006-01-13 Andrew Pinski + + PR tree-opt/24365 + * tree-inline.c (declare_return_variable): If the return variable + was marked as a non gimple complex, set the return slot variable + to be a non gimple comple variable. + 2006-01-13 Richard Guenther * builtins.c (expand_builtin_sincos): New function. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e1cbca66b14..593db14ca54 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-01-13 Andrew Pinski + + PR tree-opt/24365 + * g++.dg/opt/complex5.C: New test. + 2006-01-13 Richard Guenther * gcc.target/i386/387-9.c: New testcase. diff --git a/gcc/testsuite/g++.dg/opt/complex5.C b/gcc/testsuite/g++.dg/opt/complex5.C new file mode 100644 index 00000000000..0da0738b327 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/complex5.C @@ -0,0 +1,16 @@ +// PR 24365 +// { dg-do compile } +// { dg-options "-O2" } + +typedef __complex__ double cdouble; +inline cdouble to_complex(double r) { + cdouble z; + __real__ z = r; + return z; +} +cdouble elt_zero() { + cdouble a = to_complex(0.0); + a+=1.0; + return a; +} + diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index be38fc937e1..fd3f159f0b1 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -1233,6 +1233,10 @@ declare_return_variable (inline_data *id, tree return_slot_addr, var = return_slot_addr; else var = build_fold_indirect_ref (return_slot_addr); + if (TREE_CODE (TREE_TYPE (result)) == COMPLEX_TYPE + && !DECL_COMPLEX_GIMPLE_REG_P (result) + && DECL_P (var)) + DECL_COMPLEX_GIMPLE_REG_P (var) = 0; use = NULL; goto done; }