[gnu.gcc.bug] GNU gcc 1.35 -fpcc-struct-return and Sun386i don't mix

ado@NCIFCRF.GOV (Arthur David Olson) (05/20/89)

(We're running SunOS 4.0.1 on a Sun386i.)

Description:
	GNU gcc 1.35's -fpcc-struct-return option can cause problems on a
	Sun386i.

Repeat-By:
	When the sample program below is compiled without the
	-fpcc-struct-return option, it works fine; when -fpcc-struct-return
	is used, an "OOPS!" message is produced.

	Script started on Fri May 19 23:13:27 1989
	bossie$ cat try.c
	struct s {
		long	l[2];
	};

	struct s
	func(c)
	{
	    if (c != 0)
		write(2, "OOPS!\n", 6);
	}

	main()
	{
		(void) func(0);
	}
	bossie$ /usr/local/bin/gcc -v try.c
	gcc version 1.35
	 /usr/local/lib/gcc-cpp -v -undef -D__GNUC__ -Dunix -Di386 -Dsun386 -Dsun -D__unix__ -D__i386__ -D__sun386__ -D__sun__ try.c /tmp/cca03360.cpp
	GNU CPP version 1.35
	 /usr/local/lib/gcc-cc1 /tmp/cca03360.cpp -quiet -dumpbase try.c -version -o /tmp/cca03360.s
	GNU C version 1.35 (80386, Sun syntax) compiled by CC.
	 as -i386 -o try.o /tmp/cca03360.s
	 ld -e _start -dc -dp /lib/crt0.o try.o /usr/local/lib/gcc-gnulib -lc
	bossie$ a.out
	bossie$ /usr/local/bin/gcc -v -fpcc-struct-return try.c
	gcc version 1.35
	 /usr/local/lib/gcc-cpp -v -undef -D__GNUC__ -Dunix -Di386 -Dsun386 -Dsun -D__unix__ -D__i386__ -D__sun386__ -D__sun__ try.c /tmp/cca03366.cpp
	GNU CPP version 1.35
	 /usr/local/lib/gcc-cc1 /tmp/cca03366.cpp -quiet -dumpbase try.c -fpcc-struct-return -version -o /tmp/cca03366.s
	GNU C version 1.35 (80386, Sun syntax) compiled by CC.
	 as -i386 -o try.o /tmp/cca03366.s
	 ld -e _start -dc -dp /lib/crt0.o try.o /usr/local/lib/gcc-gnulib -lc
	bossie$ a.out
	OOPS!
	bossie$ /usr/local/bin/gcc -S -fpcc-struct-return try.c
	bossie$ cat try.s
		.file	"try.c"
		.version	"GNU C 1.35"
	gcc_compiled.:
		.text
	.LC0:
		.byte	0x4f,0x4f,0x50,0x53,0x21,0xa,0x0
		.align 4
		.globl	func
	func:
		pushl %ebp
		movl %esp,%ebp
		pushl %ebx
		movl 8(%ebp),%ebx
		cmpl $0,8(%ebp)
		je .L2
		pushl $6
		pushl $.LC0
		pushl $2
		call write
		leal 12(%esp),%esp
	.L2:
		movl %ebx,%eax
	.L1:
		leal -4(%ebp),%esp
		popl %ebx
		leave
		ret
		.align 4
		.globl	main
	main:
		pushl %ebp
		movl %esp,%ebp
		subl $8,%esp
		leal -8(%ebp),%eax
		pushl $0
		pushl %eax
		call func
	.L3:
		leave
		ret
	bossie$ exit

	script done on Fri May 19 23:14:50 1989
-- 
	Arthur David Olson    ado@ncifcrf.gov    ADO is a trademark of Ampex.