optimization/4733: Incorrect code when aliasing double and struct on ARM -O2

Ben Harris bjh21@netbsd.org
Mon Oct 29 10:16:00 GMT 2001


The following reply was made to PR optimization/4733; it has been noted by GNATS.

From: Ben Harris <bjh21@netbsd.org>
To: <Richard.Earnshaw@arm.com>
Cc: <gcc-gnats@gcc.gnu.org>
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                                                   <bjh21@netbsd.org>
 Portmaster, NetBSD/arm26               <URL: http://www.netbsd.org/Ports/arm26/ >
 
 



More information about the Gcc-prs mailing list