[gnu.gcc.bug] gcc 1.35 on 386i can yield bad assembly code if -finline-functions used

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

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

Description:
	Gcc 1.35 on a Sun386i can yield unassemblable code if the
	-finline-functions option is used.

Repeat-By:
Script started on Mon May  1 11:40:09 1989
bossie$ cat try.c
typedef struct {
	int		callback;
} CallbackRec;

typedef CallbackRec *	CallbackList;

typedef struct {
	int	external_form;
} CallbackStruct;

extern CallbackStruct **	FetchCallbackStruct();
extern CallbackStruct *		XtNew();

static CallbackList *
FetchCallbackList(widget, name, create)
int	widget;
char *  name;
char	create;
{
	register CallbackStruct **callbacks = FetchCallbackStruct();

	if (callbacks == 0)
		return 0;
	if (*callbacks == 0) {
		if (!create) {
			static CallbackList emptyList = 0;

			return &emptyList;
		}
		*callbacks = XtNew();
		(*callbacks)->external_form = 0;
	}
	return 0;
}

void
XtAddCallback()
{
	(void) FetchCallbackList(0, 0, 0);
}
bossie$ /usr/local/bin/gcc -v -O -finline-functions -c 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__ -D__OPTIMIZE__ try.c /tmp/cca01547.cpp
GNU CPP version 1.35
 /usr/local/lib/gcc-cc1 /tmp/cca01547.cpp -quiet -dumpbase try.c -finline-functions -O -version -o /tmp/cca01547.s
GNU C version 1.35 (80386, Sun syntax) compiled by GNU C version 1.35.
 as -i386 -o try.o /tmp/cca01547.s
Assembler: try.c
	aline 24	: syntax error
bossie$ /usr/local/bin/gcc -v -O -finline-functions -S 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__ -D__OPTIMIZE__ try.c /tmp/cca01551.cpp
GNU CPP version 1.35
 /usr/local/lib/gcc-cc1 /tmp/cca01551.cpp -quiet -dumpbase try.c -finline-functions -O -version -o try.s
GNU C version 1.35 (80386, Sun syntax) compiled by GNU C version 1.35.
bossie$ cat try.s
	.file	"try.c"
	.version	"GNU C 1.35"
	.optim
gcc_compiled.:
	.data
	.align 4
emptyList.0:
	.long	0
	.text
	.align 4
	.globl	XtAddCallback
XtAddCallback:
	pushl %ebp
	movl %esp,%ebp
	pushl %esi
	pushl %ebx
	xorl %esi,%esi
	call FetchCallbackStruct
	movl %eax,%ebx
	testl %ebx,%ebx
	je .L14
	cmpl $0,(%ebx)
	jne .L14
	testb %si,%si
	je .L14
	call XtNew
	movl %eax,(%ebx)
	movl $0,(%eax)
.L14:
	leal -8(%ebp),%esp
	popl %ebx
	popl %esi
	leave
	ret
bossie$ exit

script done on Mon May  1 11:40:47 1989
-- 
			Space:  Canada, 0 tries ever.
	Arthur David Olson    ado@ncifcrf.gov    ADO is a trademark of Ampex.