Use of compound_literal_expr in c vs target_expr in c++ for compound literals

Fariborz Jahanian fjahanian@apple.com
Mon Jul 24 22:29:00 GMT 2006


On Jul 24, 2006, at 3:07 PM, Andrew Pinski wrote:

>>
>>
>> gcc generates two separate trees for compound literals in c and c++.
>> As in this test case:
>>
>> struct S {
>>          int i,j;
>> };
>> void foo (struct S);
>>
>> int main ()
>> {
>>          foo((struct S){1,1});
>> }
>
>>      On the other hand, such a guard does not exist for a
>> compound_literal_expr and when gimple_add_tmp_var is called, it
>> asserts. So, I added check for
>>      !DECL_SEEN_IN_BIND_EXPR_P (decl) in
>> gimplify_compound_literal_expr before call to gimple_add_tmp_var is
>> made. As in the following diff:
>
> I think you are trying to fix PR 28418 which is an ICE in  
> gimple_add_tmp_var with
> compound literals in C.

My patch fixes the test case in PR 28418 as well. There are really  
two issues here:
Should we gimplify compound_literal_expr twice? Regardless of this  
issue, how do we avoid calling gimple_add_tmp_var on the same  
variable. My patch addresses the latter.

- Fariborz

>
> Thanks,
> Andrew Pinski



More information about the Gcc mailing list