🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by George Young Mon, 06 Apr 1992 13:18
gcc-2.1-sparc-sun-sunos4.0.3 -fcaller-saves generates bad code
#156
Author: George Young
Date: Mon, 06 Apr 1992 13:18
50 lines
2532 bytes
Environment: Sun 4/390 SunOS 4.0.3, gcc 2.1
When a module of a C program compiled as:
	gcc -O2 -g k.c -c
or
	gcc -O -fcaller-saves -g k.c -c
the program fails with a bus error.  When compiled as:
	gcc -O2 -fno-caller-saves -g k.c -c
or
	gcc -O -g k.c -c
it runs fine.  

Here's a script of compiling the file:

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
make CFLAGS='-O2 -v -g'
gcc -O2 -v -g   -c k.c -o k.o
Reading specs from /usr/local/lib/gcc-lib/sparc-sun-sunos4.0.4/2.1/specs
gcc version 2.1
 /usr/local/lib/gcc-lib/sparc-sun-sunos4.0.4/2.1/cpp -lang-c -v -undef -D__GNUC__
=2 -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__un
ix -D__OPTIMIZE__ -g k.c /usr/tmp/cca06048.i
GNU CPP version 2.1 (sparc)
 /usr/local/lib/gcc-lib/sparc-sun-sunos4.0.4/2.1/cc1 /usr/tmp/cca06048.i -quiet -
dumpbase k.c -g -O2 -version -o /usr/tmp/cca06048.s
GNU C version 2.1 (sparc) compiled by GNU C version 2.1.
In file included from j.h:54, from k.c:15:
/usr/include/memory.h:6: warning: conflicting types for built-in function `memcpy
'
 as -o k.o /usr/tmp/cca06048.s
gcc a.o ai.o ap.o au.o c.o cc.o cf.o cg.o cp.o cr.o ct.o cx.o f.o i.o io.o j.o k.
o lj.o m.o p.o pc.o pv.o r.o rt.o s.o t.o u.o ut.o v.o vb.o ve.o vg.o vh.o vi.o v
m.o vp.o vs.o vz.o w.o x.o xf.o xs.o xw.o -lm -o j

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Stepping though with gdb seems to indicate it crashes when returning from
the function 'IfromD', but I don't know enough about function call assembler
code to pinpoint it better.

The source code for this program is ~260 kbytes, so I have not included it here.
I have made it available via anonymous ftp from:
	 vdd.vlsi.ll.mit.edu: ~ftp/pub/j.tar.Z

To manifest the bug, just run make "CFLAGS=-O2 -g", and do:
	echo '.i3 4' | ./j

George Young,  Rm. B-141		young@vlsi.ll.mit.edu
MIT Lincoln Laboratory			young@vdd.vlsi.ll.mit.edu
244 Wood St.				[129.55.11.1]
Lexington, Massachusetts  02173-9108	(617) 981-2756
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads