Subject: port-powerpc/8952: gcc on powerpc sometimes generates bad struct copies
To: None <>
From: Dan Winship <danw@MIT.EDU>
List: netbsd-bugs
Date: 12/04/1999 13:20:14
>Number:         8952
>Category:       port-powerpc
>Synopsis:       gcc on powerpc sometimes generates bad struct copies
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    port-powerpc-maintainer (NetBSD/powerpc Portmasters)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Dec  4 11:42:01 1999
>Originator:     Dan Winship
>Release:        current
System: NetBSD frotz 1.4M NetBSD 1.4M (FROTZ) #19: Fri Dec 3 14:22:05 EST 1999 root@frotz:/usr/src/sys/arch/macppc/compile/FROTZ macppc

	gcc on the powerpc outputs floating-point instructions to do
	64-bit copies, but doesn't check that the data is properly

danw@frotz:/tmp> cat foo.c
int main(int argc, char **argv)
  struct foo { short a, b, c, d; } one;
  struct bar { short e; struct foo f; } two;

  two.f = one;
danw@frotz:/tmp> gcc -o foo foo.c
danw@frotz:/tmp> ./foo
Bus error (core dumped)

	Fix gcc to know it can't do that. (I think it actually only
	needs to be 32-bit aligned: Changing the shorts to ints makes
	it work.)