This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: redundant stores in C++
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: Dale Johannesen <dalej at apple dot com>
- Cc: GCC Development <gcc at gcc dot gnu dot org>
- Date: Sat, 1 Oct 2005 22:29:58 -0400
- Subject: Re: RFC: redundant stores in C++
- References: <80d679bd87008f781f0b7bada9a29fdb@apple.com>
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
possible; comments?
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 ();
}
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.
-- Pinski