[LLVMdev] LLVM 2.4 problem? (resend)

David Vandevoorde daveed at vandevoorde.com
Wed Oct 15 09:33:17 PDT 2008

On Oct 15, 2008, at 12:00 PM, David Vandevoorde wrote:

> On Oct 15, 2008, at 9:43 AM, Duncan Sands wrote:
>>> True, but note that it is the address of a variable that is used,  
>>> not
>>> the value.
>> Yes, but why do you think they should get a different address?  I can
>> understand that it is surprising that they do, but determining  
>> whether
>> this is legal or not requires reading the language standard.
>> Hopefully
>> a language lawyer can chime in and say whether this transform is  
>> valid
>> or not.
> FWIW, I've been discussing this with some of my colleagues (who may
> well be the foremost experts on this topic), and so far we don't have
> a definite answer (we're looking at C99 and C++).  We do think that a
> strict reading of the standard allows the optimization, but there is
> also some suspicion that that is unintended (at least in C++).

FWIW, a C++ CoreWG issue has been opened to clarify this.

(My own position is that different objects should have guaranteed  
different addresses.  To alias them, a code generator must prove that  
it wouldn't change observable behavior.)


More information about the llvm-dev mailing list