Path: utzoo!telly!attcan!dptcdc!jarvis.csri.toronto.edu!mailrus!cwjcc!tut.cis.ohio-state.edu!MOOSE.CITA.UTORONTO.CA!trq From: trq@MOOSE.CITA.UTORONTO.CA (Tom Quinn) Newsgroups: gnu.gcc.bug Subject: bug in sparc gcc 1.33 Message-ID: <8902091504.AA08256@moose.cita.utoronto.ca> Date: 9 Feb 89 15:04:51 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 146 The following code compiles incorrectly with the "-g -O" options. This is gcc version 1.33 on a Sun4/110 running SunOs 4.0. The problem appears to be a typo in sparc.md. A fix is given below. Tom Quinn Canadian Institute for Theoretical Astrophysics trq@moose.cita.utoronto.ca UUCP - decvax!utgpu!moose!trq BITNET - quinn@utorphys.bitnet ARPA - trq%moose.cita.toronto.edu@relay.cs.net The compile: gcc -S -g -v -O -c abbrev.c -o abbrev.o gcc version 1.33 /usr/local/lib/gcc-cpp -v -undef -D__GNUC__ -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__OPTIMIZE__ abbrev.c /tmp/cca22552.cpp GNU CPP version 1.33 /usr/local/lib/gcc-cc1 /tmp/cca22552.cpp -quiet -dumpbase abbrev.c -g -O -version -o abbrev.o GNU C version 1.33 (sparc) compiled by GNU C version 1.33. The bad assembly: .stabn 68,0,64,LM7 LM7: sethi %hi(_Vlast_abbrev_text),%g1 ldsb [%g1+%lo(a1)],%o0 # a1??? cmp %o0,3 bne L4 nop A fix to sparc.md: diff -c -r1.1 sparc.md *** /tmp/,RCSt1a22560 Thu Feb 9 10:00:21 1989 --- sparc.md Thu Feb 9 08:18:57 1989 *************** *** 1696,1702 { cc_status.flags |= CC_KNOW_HI_G1; cc_status.mdep = XEXP (operands[1], 0); ! return \"sethi %%hi(%m1),%%g1\;ldsb [%%g1+%%lo(a1)],%0\"; } return \"ldsb %1,%0\"; }") --- 1696,1702 ----- { cc_status.flags |= CC_KNOW_HI_G1; cc_status.mdep = XEXP (operands[1], 0); ! return \"sethi %%hi(%m1),%%g1\;ldsb [%%g1+%%lo(%m1)],%0\"; } return \"ldsb %1,%0\"; }") *************** *** 1712,1718 { cc_status.flags |= CC_KNOW_HI_G1; cc_status.mdep = XEXP (operands[1], 0); ! return \"sethi %%hi(%m1),%%g1\;ldub [%%g1+%%lo(a1)],%0\"; } return \"ldub %1,%0\"; }") --- 1712,1718 ----- { cc_status.flags |= CC_KNOW_HI_G1; cc_status.mdep = XEXP (operands[1], 0); ! return \"sethi %%hi(%m1),%%g1\;ldub [%%g1+%%lo(%m1)],%0\"; } return \"ldub %1,%0\"; }") The code: enum Lisp_Type { Lisp_Int, Lisp_Symbol, Lisp_Marker, Lisp_String, Lisp_Vector, Lisp_Cons, Lisp_Object_Unused_1, Lisp_Buffer, Lisp_Subr, Lisp_Internal, Lisp_Intfwd, Lisp_Boolfwd, Lisp_Process, Lisp_Objfwd, Lisp_Object_Unused_2, Lisp_Internal_Stream, Lisp_Buffer_Local_Value, Lisp_Some_Buffer_Local_Value, Lisp_Buffer_Objfwd, Lisp_Void, Lisp_Window, Lisp_Window_Configuration }; struct Lisp_String { int size; unsigned char data[1]; }; struct Lisp_Symbol { struct Lisp_String *name; int value; int function; int plist; struct Lisp_Symbol *next; }; struct buffer_text { unsigned char *p1; unsigned char *p2; int size1; int size2; int gap; int modified; int head_clip; int tail_clip; int pointloc; }; extern int Qnil; int Vlast_abbrev; int Vlast_abbrev_text; int last_abbrev_point; extern struct buffer_text bf_text; int Funexpand_abbrev () { int opoint = bf_text.pointloc ; int adjust = 0; if (last_abbrev_point < bf_text.head_clip || last_abbrev_point > (bf_text.size1+bf_text.size2-bf_text.tail_clip) ) return Qnil; bf_text.pointloc = (last_abbrev_point); if (((enum Lisp_Type) ((Vlast_abbrev_text) >> 24 )) == Lisp_String) { int val; ((val) = ((int)( Lisp_String) << 24 ) + ((int) ( ((struct Lisp_Symbol *) ((Vlast_abbrev) & ((1<<24 ) - 1) ) ) ->value) & ((1<<24 ) - 1) )) ; adjust = ((struct Lisp_String *) ((val) & ((1<<24 ) - 1) ) ) ->size; del_range (bf_text.pointloc , bf_text.pointloc + adjust); InsCStr (((struct Lisp_String *) ((Vlast_abbrev_text) & ((1<<24 ) - 1) ) ) ->data, ((struct Lisp_String *) ((Vlast_abbrev_text) & ((1<<24 ) - 1) ) ) ->size); adjust -= ((struct Lisp_String *) ((Vlast_abbrev_text) & ((1<<24 ) - 1) ) ) ->size; Vlast_abbrev_text = Qnil; } bf_text.pointloc = (last_abbrev_point < opoint ? opoint - adjust : opoint); return Qnil; }