[PATCH] Fix PR c++/42556

Jie Zhang jie@codesourcery.com
Tue Mar 23 09:57:00 GMT 2010


On 03/23/2010 04:52 PM, Eric Botcazou wrote:
>> The cause of this PR is that the C++ front end splits the nonconstant
>> part initialization of
>>
>>     int v[4] = {a, b, c, d};
>>
>> into separate statements. In this test case, all the elements in the
>> initializers are noncontant. After nonconstant splitting, an empty
>> CONSTRUCTOR tree is left. The C++ front end does not remove it although
>> it can. But in GCC an empty CONSTRUCTOR means zero out the whole
>> structure. And the later passes of GCC failed to remove the useless
>> zeroing.
>
> Why not just remove the empty CONSTRUCTOR if it is useless?
>
Yes. My patch is to make sure that empty CONSTRUCTOR is removed when it 
can be removed, i.e. all its elements have been initialized.

-- 
Jie Zhang
CodeSourcery
(650) 331-3385 x735



More information about the Gcc-patches mailing list