Subject: port-sparc/4480: 64-bit problem
To: None <>
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
>Originator:     Robby Griffin
>Release:        1.2
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
	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 :)
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;

foobarbaz% gcc -o buserror buserror.c

foobarbaz% buserror
Bus error