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 the one entry mem{{,p}cpy,move,set} optimization aliasing issues (PR middle-end/29272)


On 9/29/06, Jakub Jelinek <jakub@redhat.com> wrote:
Hi!

While the PR29272 testcase is IMHO violating the strict aliasing rules
(my reading of 6.5 is that for the heap object the first memcpy call gives the
object struct Node * effective type, so it shouldn't then be accessed as
int), I believe it is possible to come up with a standard conforming
testcase for this (e.g. when the object is not allocated, we access it
mostly through its original type but additionall with memcpy through an
aliasing incompatible pointer).

Oh, 6.5 is indeed explicit about memcpy. Changing all pointer types the testcase uses for freelist handling to char[sizeof(void*)] would make it valid but completely ugly to look at.

I wonder how the C people thought one would manage memory with these
rules...  (and I wonder how glibc does it, and if it is going to break
if we inline
glibc memory management into user code with LTO one day...)

Richard.


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