From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ben Harris To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org Subject: Re: optimization/4733: Incorrect code when aliasing double and struct on ARM -O2 Date: Mon, 29 Oct 2001 10:16:00 -0000 Message-id: <20011029181604.4259.qmail@sourceware.cygnus.com> X-SW-Source: 2001-10/msg00665.html List-Id: The following reply was made to PR optimization/4733; it has been noted by GNATS. From: Ben Harris To: Cc: Subject: Re: optimization/4733: Incorrect code when aliasing double and struct on ARM -O2 Date: Mon, 29 Oct 2001 18:08:14 +0000 (GMT) On Mon, 29 Oct 2001, Richard Earnshaw wrote: > Nope, this code violates the ANSI memory aliasing rules. Ah yes, I'd tried -fno-strict-aliasing on 2.95.3, but not on 20011023. Thanks. > According to > ANSI, the only way to do this portably is to memcpy between the types; Yeah, that works. The code it produces isn't all that wonderful, though: ... mov r3, sp stmia r3, {r0-r1} ldmia r3, {r0, r1} add r2, sp, #8 stmia r2, {r0, r1} mov r2, #2032 ldrh r3, [sp, #14] @ movhi ... -- Ben Harris Portmaster, NetBSD/arm26