Re: RFC: redundant stores in C++

2005-10-04 Thread Dale Johannesen
On Oct 1, 2005, at 8:41 PM, Andrew Pinski wrote: On Oct 1, 2005, at 11:10 PM, Dale Johannesen wrote: But better fix would be not call split_nonconstant_init_1 for local decls and have the front-end produce a CONSTRUCTOR which is just like what the C front-end produces. I'll try it. This pat

Re: RFC: redundant stores in C++

2005-10-01 Thread Andrew Pinski
On Oct 1, 2005, at 11:10 PM, Dale Johannesen wrote: But better fix would be not call split_nonconstant_init_1 for local decls and have the front-end produce a CONSTRUCTOR which is just like what the C front-end produces. I'll try it. This patch should fix the problem and also fixes FSF PR

Re: RFC: redundant stores in C++

2005-10-01 Thread Dale Johannesen
On Oct 1, 2005, at 7:29 PM, Andrew Pinski wrote: I don't think this will work for the following code: void foo(char a, char b) { char x[4] = { a, b } ; if (x[3] != 0) abort (); } Duh. I thought that was too easy. But better fix would be not call split_nonconstant_init_1 for local de

Re: RFC: redundant stores in C++

2005-10-01 Thread Andrew Pinski
On Oct 1, 2005, at 5:54 PM, Dale Johannesen wrote: In C++, when we have an automatic array with variable initializers: void bar(char[4]); void foo(char a, char b, char c, char d) { char x[4] = { a, b, c, d }; bar(x); } Testsuite passes with this but I can believe improvements are possibl

RFC: redundant stores in C++

2005-10-01 Thread Dale Johannesen
In C++, when we have an automatic array with variable initializers: void bar(char[4]); void foo(char a, char b, char c, char d) { char x[4] = { a, b, c, d }; bar(x); } the C++ FE generates 32-bit store(s) of 0 for the entire array, followed by stores of the individual elements. In the case