Path: utzoo!telly!ddsw1!spl1!lll-winken!uunet!tut.cis.ohio-state.edu!CS.UTEXAS.EDU!ascway!wkd From: ascway!wkd@CS.UTEXAS.EDU (Bill Duttweiler) Newsgroups: gnu.gcc.bug Subject: gcc bug Message-ID: <8903312155.AA28791@sake.SWS-ASC.SLB.COM> Date: 31 Mar 89 21:55:52 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 67 gcc-1.34 on a SUN4/110 running 4.0.1. tm.h -> tm-sparc.h md -> sparc.md The following snippet of C code results in incorrect assembly code when compiled using: gcc -traditional -O -S -meager gcc-bug.c The -meager switch is clearly responsible. The .s file that comes out matches the dissassembly using adb. /* ** gcc-bug.c ** ** Demonstrates a bug in the SPARC processing of the -meager switch. ** */ #define SOME_CONSTANT (4) int Foo(status) { int return_code; return_code = (status >= SOME_CONSTANT); exit(return_code); } main() { Foo(0); } Here is the s file: gcc_compiled.: .text .align 4 .global _Foo .proc 1 _Foo: !#PROLOGUE# 0 save %sp,-112,%sp !#PROLOGUE# 1 mov 0,%o0 cmp %i0,3 ble L2 ! eager mov 1,%o0 L2: call _exit,0 nop ret restore .align 4 .global _main .proc 1 _main: !#PROLOGUE# 0 save %sp,-112,%sp !#PROLOGUE# 1 call _Foo,0 mov 0,%o0 ret restore