This is the mail archive of the gcc-patches@gcc.gnu.org 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


Michael Matz wrote:

> So, let's assume you meant a read-access above, then you say this better 
> not be invalid, if the declared type is 'int', but you're fine if it were 
> an char[]?  But then you need to say how //something looks like, because 
> some examples will be invalid also in your definition, for instance if 

My claim is that no value of "//something" should render this code
invalid.  Including memcpy, stores through casted pointers, or placement
new.  The lifetime of that int extends through its scope, and until it
goes out of scope, it's an int.  Period.

> Our interpretations

(Whose interpretation is this?  Is it some segment of the ISO committee,
or some segment of the GCC developers, or some segment of SuSE, or
something else?  This section is parenthetical because it probably
doesn't have any bearing on the outcome of the discussion; I have
respect for all of these groups.  But, if there's actually something
settled about this at the standards level then I'd just go cry in a
corner and not bother everyone else about this.)

Your further discussion involves GCC internals and limitations on what
we do or do not know at various points in the compiler.  That's clearly
important for practical purposes, but the first priority should be to
decide what we want the language to mean.  Of course, it's likely that
the compiler will have to be conservative (i.e., assume some worst-case
situations when it cannot prove otherwise).  But, I think it's still
valuable to understand on the language.

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


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