Commit 7dc17098 by Jason Merrill

re PR rtl-optimization/7145 (g++ -O with structure initializer & return value…

re PR rtl-optimization/7145 (g++ -O with structure initializer & return value optimization generates bad code)

        PR optimization/7145
        * tree.c (cp_copy_res_decl_for_inlining): Also copy DECL_INITIAL.

[[Split portion of a mixed commit.]]

From-SVN: r55262.2
parent 98c07d7b
// PR optimization/7145
// Bug: The NRV optimization caused us to lose the initializer for 'ret'.
// { dg-options -O }
// { dg-do run }
struct GdkColor {
long pixel;
short red;
short green;
short blue;
};
inline GdkColor mkcolor() {
GdkColor ret={0,1,2,3};
return ret;
}
int
main()
{
GdkColor col=mkcolor();
return (col.pixel != 0 || col.red != 1 || col.green != 2 || col.blue != 3);
}
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