This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix C++ strict-aliasing issues with memcpy folding

On Wed, Feb 3, 2010 at 8:16 AM, Michael Matz <> wrote:
> Hi,
> On Wed, 3 Feb 2010, Dave Korn wrote:
>> >>> (incidentally it's interesting to think about what type the access '*p'
>> >>> has)
>> >> '*p' is lvalue of type 'X'.
>> >
>> > Although a part of it (the space in mem[0] at least) is a float? ?And type
>> > 'X' doesn't contain a float? ?That's surprising to say the least :)
>> Well, to me, the simple unsurprising reasoning goes like so:
>> "'p' is a value of type pointer-to-X, therefore '*p' is an lvalue of type X."
> Ah, sorry. ?I mixed concepts without stating this cleary. ?My side
> question should have been, "what type does the storage pointed to by p
> have". ?Yes, quite clearly the source construct "*p" has type X. ?But the
> answer to the question influences the fact if we may use "*p" to access
> that storage.

that is why we have all these rules about 'compatible types'  used to access
an object.  An lvalue expression of type X does not, in itself, asserts that
there is a valid object of type X behind the expression.

-- Gaby

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]