This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix the one entry mem{{,p}cpy,move,set} optimization aliasing issues (PR middle-end/29272)
- From: "Richard Guenther" <richard dot guenther at gmail dot com>
- To: "Jakub Jelinek" <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 29 Sep 2006 11:22:56 +0200
- Subject: Re: [PATCH] Fix the one entry mem{{,p}cpy,move,set} optimization aliasing issues (PR middle-end/29272)
- References: <20060929075035.GQ20982@devserv.devel.redhat.com>
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.