Subject: toolchain/20623: powerpc-cc -mcpu=403 generates wrong code
To: None <gnats-bugs@gnats.netbsd.org>
From: Juergen Hannken-Illjes <hannken@watcher.eis.cs.tu-bs.de>
List: netbsd-bugs
Date: 03/08/2003 18:31:32
>Number: 20623
>Category: toolchain
>Synopsis: powerpc-cc -mcpu=403 generates wrong code
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: toolchain-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Mar 08 09:32:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator: Juergen Hannken-Illjes
>Release: NetBSD 1.6N
>Organization:
net
>Environment:
Architecture: powerpc
Machine: powerpc
>Description:
The following function
int
inet_pton4(const char *src, unsigned char *dst)
{
unsigned long val;
val = src[0];
if (dst)
memcpy(dst, &val, 4);
return (1);
}
gets compiled (using -m403) as:
inet_pton4:
mr. 4,4
lbz 0,0(3)
bc 12,2,.L3
stw 0,0(4)
.L3:
li 3,1
blr
The "memcpy" is reduced to "stw 0,0(4)". If "dst" is not 32bit
aligned, this results in an alignment exception.
>How-To-Repeat:
See above.
>Fix:
This fix removes the problem but I don't know if it is the right way
to go ...
RCS file: /cvsroot/src/gnu/dist/toolchain/gcc/config/rs6000/netbsd.h,v
retrieving revision 1.8
diff -u -2 -r1.8 netbsd.h
--- netbsd.h 2003/02/28 17:30:16 1.8
+++ netbsd.h 2003/03/08 17:14:47
@@ -47,5 +47,5 @@
We avoid their use here. */
#undef CC1_SPEC
-#define CC1_SPEC "-mno-multiple"
+#define CC1_SPEC "-mno-multiple -mstrict-align"
/* Provide a LINK_SPEC approriate for NetBSD. */
>Release-Note:
>Audit-Trail:
>Unformatted: