Article View: gnu.gcc.bug
Article #819Error in GCC 1.36 on Convex
From: Gerlach van Beinum
Date: Wed, 22 Nov 1989 13:14
Date: Wed, 22 Nov 1989 13:14
101 lines
2178 bytes
2178 bytes
There seems to be a bug in the gcc 1.36 compiler.
The generated assembler code for type long long (64
bit int's) is wrong.
The error prevents 'gdb' from being compiled correctly
(There is a long long in struct filehdr which is used in gdb).
Is this a known bug ? Does anybody have a fix ?
An example of a short program generating the bug follows
here (including generated assembly):
-----------------------------------------
long long ll = 123;
main()
{
printf("%ld\n",(long)ll);
printf("%LL\n",(long)ll); /* %LL is the specifier for64 bit int's */
}
------------------------------------------------------------
Here follows the code produced by the 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
------------------------------------------------------------
Here follows the (correct) code generated by cc, the
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
-------------
--
------------------------------------------------------------------
Gerlach van Beinum USENET: gvb@tnoibbc PHONE: +31 15 606447
------------------------------------------------------------------
Technical Details
Message-ID:
<1289@tnoibbc.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uunet!mcsun!hp4nl!tnoibbc!gvbShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uunet!mcsun!hp4nl!tnoibbc!gvb From: gvb@tnoibbc.UUCP (Gerlach van Beinum) Newsgroups: gnu.gcc.bug Subject: Error in GCC 1.36 on Convex Keywords: GNU, GCC, Convex Message-ID: <1289@tnoibbc.UUCP> Date: 22 Nov 89 13:14:39 GMT Lines: 101