Path: utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!relay.eu.net!tnoibbc!gvb From: tnoibbc!gvb@relay.eu.net (Gerlach van Beinum) Newsgroups: gnu.gcc.bug Subject: gcc bug in long long handling on convex. Message-ID: <8911221519.AA03447@tnoibbc> Date: 22 Nov 89 15:19:08 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 84 There seems to be a bug in the gcc 1.36 compiler The generated assembly code for type long long (64 bit int's) is wrong. This error is the reason we can't compile gdb with gcc ( gdw works when compiled with the local compiler) See small file below. ----------------------------------------- long long ll = 123; main() { printf("%ld\n",(long)ll); printf("%LL\n",(long)ll); /* %LL is the specifier for64 bit int's */ } --------------------------------------- Resulting .s file with Gnu compiler : ;NO_APP gcc_compiled.: .globl _ll .data .align 4 _ll: ds.w 123 ; <=== should be in the 2nd word! ds.w 0 .text LC0: ds.b "%ld\012\000" .text .align 2 .globl _main _main: ld.w _ll,s0 ; <== should be ld.l ! psh.w s0 pshea LC0 mov sp,ap calls _printf ld.w 12(fp),ap rtn -------------------------------------- Resulting .s file wilt convex compiler : .fpmode native LL0: .data .align 2 .globl _ll _ll: ds.l 0x00000007b .text .globl _main _main: sub.w #.L1,sp .data 1 L6: ds.b "%ld\12\0" .text ld.l _ll,s0 ;70 : <=== Correct. ;5 psh.w s0 ;67 pshea L6 ;67a mov sp,ap pshea #2 calls _printf ;37 add.w #12,sp ld.w 12(fp),ap .data 1 L7: ds.b "%LL\12\0" .text ld.l _ll,s0 ;70 psh.l s0 ;67 pshea L7 ;67a mov sp,ap pshea #2 calls _printf ;37 add.w #16,sp ld.w 12(fp),ap rtn .L1 = 0 .data