[gnu.gcc.bug] Error in GCC 1.36 on Convex

gvb@tnoibbc.UUCP (Gerlach van Beinum) (11/22/89)

	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
------------------------------------------------------------------