🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #201

Re: bug in gcc2.2.2, please acknowledge.

#201
From: Colin Plumb
Date: Fri, 24 Jul 1992 23:57
88 lines
2483 bytes
In article <9207250016.AA02921@bass.noname> paisley@bass.ai.mit.EDU (Beau Paisley) writes:
>/* When you execute this program it generates an illegal instruction message */
>/* No syntax error is given for the illegal allocation syntax */
>
>extern "C" void exit( int );
>
>int test(int j)
>{
>	return( 0 );
>}
>
>main( )
>{
>	int n=4;
>	double x[n];	/* This seems to be the statement that gcc goofs up */
>			/* The c++ version of gcc messes it up also */
>	int i;
>	i= test(0);
>
>	exit(0);
>}

To save people the trouble of flaming for a proper bug report, I have
duplicated this error on gcc 2.2.2 for a SPARC.

Reading specs from /gnu/lib/gcc-lib/sun4/2.2.2/specs
gcc version 2.2.2
 /gnu/lib/gcc-lib/sun4/2.2.2/cpp -lang-c -v -undef -D__GNUC__=2 -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix /tmp/bug.c /usr/tmp/cca11767.i
GNU CPP version 2.2.2 (sparc)
 /gnu/lib/gcc-lib/sun4/2.2.2/cc1 /usr/tmp/cca11767.i -quiet -dumpbase bug.c -version -o /usr/tmp/cca11767.s
GNU C version 2.2.2 (sparc) compiled by GNU C version 2.2.2.
 as -o bug.o /usr/tmp/cca11767.s
 /gnu/lib/gcc-lib/sun4/2.2.2/ld -e start -dc -dp /lib/crt0.o -L/gnu/lib/gcc-lib/sun4/2.2.2 -L/gnu/lib bug.o -lgcc -lc -lgcc


The resultant a.out file dumps core with an illegal instruction error.
The assembler produced is

gcc2_compiled.:
.text
	.align 4
	.global _test
	.proc	04
_test:
	!#PROLOGUE# 0
	save %sp,-112,%sp
	!#PROLOGUE# 1
	st %i0,[%fp+68]
	mov 0,%i0
	b,a L1
L1:
	ret
	restore
	.align 4
	.global _main
	.proc	04
_main:
	!#PROLOGUE# 0
	save %sp,-144,%sp
	!#PROLOGUE# 1
	call ___main,0
	nop
	mov %sp,%l2
	mov 4,%o0
	st %o0,[%fp-20]
	ld [%fp-20],%o0
	add %o0,-1,%l0
	add %l0,1,%l1
	sll %l1,6,%o0
	mov %o0,%l1
	add %l0,1,%o1
	sll %o1,3,%o0
	add %sp,116,%o2
	sub %o2,%sp,%o1
	add %o0,%o1,%o0
	sub %sp,%o0,%sp
	add %sp,116,%l3
	mov 0,%o0
	call _test,0
	nop
	st %o0,[%fp-24]
	mov 0,%o0
	call _exit,0
	nop
	mov %l2,%sp
L2:
	ret
	restore
Technical Details
Message-ID: <92Jul25.035723edt.61@jarvis.csri.toronto.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!eecg.toronto.edu!colin
References: <9207250016.AA02921@bass.noname>

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!eecg.toronto.edu!colin
From: colin@eecg.toronto.edu (Colin Plumb)
Subject: Re: bug in gcc2.2.2, please acknowledge.
Message-ID: <92Jul25.035723edt.61@jarvis.csri.toronto.edu>
Sender: gnulists@ai.mit.edu
Organization: University of Toronto
References: <9207250016.AA02921@bass.noname>
Distribution: gnu
Date: Fri, 24 Jul 1992 23:57:03 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 89