[llvm-commits] [llvm-gcc-4.2] r126672 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Stuart Hastings stuart at apple.com
Wed Mar 2 15:32:16 PST 2011


On Mar 1, 2011, at 1:01 AM, Duncan Sands wrote:

> Hi Stuart,
> 
>> Skip anonymous union fields when initializing.  Radar 9055247.
> 
> please add a testcase.

r126896

>> -  // Unions are initialized using the first member field.  Find it.
>> +  // Unions are initialized using the first non-anonymous member field.  Find it.
> 
> I'm curious to know what this is based on?

This ICEd LLVM-GCC:

	union { int :3; double f; } u17_017 = {17.17};

> Does the C standard say this?


I'm not a language lawyer, but one of my local Language Lawyers said "yes."

stuart

> Thanks, Duncan.
> 
>>    tree Field = TYPE_FIELDS(TREE_TYPE(exp));
>>    assert(Field&&  "cannot initialize union with no fields");
>> -  while (TREE_CODE(Field) != FIELD_DECL) {
>> +  while (TREE_CODE(Field) != FIELD_DECL || DECL_NAME(Field) == NULL_TREE) {
>>      Field = TREE_CHAIN(Field);
>>      assert(Field&&  "cannot initialize union with no fields");
>>    }
>> 
>> 
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list