Subject: port-sparc/4480: 64-bit problem
To: None <gnats-bugs@gnats.netbsd.org>
From: Robby Griffin <rmg@MIT.EDU>
List: netbsd-bugs
Date: 11/13/1997 04:21:05
>Number: 4480
>Category: port-sparc
>Synopsis: misalignment causes bus errors
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: gnats-admin (GNATS administrator)
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Thu Nov 13 01:35:03 1997
>Last-Modified:
>Originator: Robby Griffin
>Organization:
MIT
>Release: 1.2
>Environment:
Sun sparc IPC, NetBSD 1.2.1 with afs33 lkm
System: NetBSD foobarbaz 1.2.1 NetBSD 1.2.1 (GENERIC_SCSI3) #7: Fri Mar 21 11:31:53 MET 1997 pk@flambard:/usr/src1/sys/arch/sparc/compile/GENERIC_SCSI3 sparc
>Description:
64-bit assignment statements tend to cause bus errors if misaligned.
Other OS's simply report an alignment error, generate a couple of extra
instructions, and get on with life. I don't know exactly what is causing
this behavior, but it should probably be changed to make porting easier.
If unintentional, then it's a bug and should be fixed :)
>How-To-Repeat:
foobarbaz% cat > buserror.c
#include <sys/types.h>
void main() {
long longs[5]; /* these are 32-bit */
quad_t *q1, *q2;
q1 = (quad_t *)(longs + 1); /* deliberately misalign */
q2 = (quad_t *)(longs + 3);
*q1 = *q2;
}
^C
foobarbaz% gcc -o buserror buserror.c
foobarbaz% buserror
Bus error
>Fix:
>Audit-Trail:
>Unformatted: