[LLVMdev] Language lawyer question

Dale Johannesen dalej at apple.com
Wed Mar 12 07:37:58 PDT 2008

On Mar 12, 2008, at 12:23 AM, Shantonu Sen wrote:

> On Mar 11, 2008, at 10:52 PM, Dale Johannesen wrote:
>>> I think the test case is bogus in terms of language correctness,
>> Why?
> My gut. I listen to my gut. More seriously, C99 section  
> paragraph 6 has:
>> When a value is stored in an object of structure or union type,  
>> including in a member
>> object, the bytes of the object representation that correspond to  
>> anypadding bytes take
>> unspecified values.42)
> and the footnote says:
>> 42) Thus, for example, structure assignment need not copyany  
>> padding bits.

Ah, thanks.  I thought that was probably the intent but couldn't find  
it.  That is definitive.

> I think that covers this case for at least C99. The test case should  
> not assume the padding bytes are copied.
> If you assume "need not copy" semantics, the test case doesn't have  
> much value for correctness. If you want LLVM to assume an  
> implementation-specific "must copy" or "must not copy" behavior, you  
> could tweak the test case as needed, I suppose. But under aggressive  
> optimization, you rapidly approach "must copy" semantics, and then  
> the question is why you don't do that for even the degenerate cases.  
> So again, it turns into an optimization test case.
> Shantonu
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080312/91426372/attachment.html>

More information about the llvm-dev mailing list