Bad asm output on alpha with asni overloading

H.J. Lu hjl@lucon.org
Sun Sep 14 12:39:00 GMT 1997


On alpha, ansi overloading generates bad/incorrect asm output for the
code enclosed here.

# gcc -O -S foo.cc
# cat foo.s
	.file	1 "foo.cc"
	.version	"01.01"
	.set noat
gcc2_compiled.:
__gnu_compiled_cplusplus:
.section	.rodata
	.align 3
$C32:
	.t_floating 1.00000000000000000000e0
.text
	.align 3
	.globl main
	.ent main
main:
	ldgp $29,0($27)
main..ng:
	lda $30,-48($30)
	.frame $30,48,$26,0
	stq $26,0($30)
	.mask 0x4000000,-48
	.prologue 1
	ldq $2,32($30)
	stq $2,16($30)
	ldq $2,40($30)
	stq $2,24($30)
	lda $1,$C32
	ldt $f1,0($1)
	stt $f1,16($30)
	stq $31,24($30)
	ldt $f10,32($30)
	cmpteq $f10,$f1,$f1
	fbeq $f1,$39
	ldt $f10,40($30)
	cmpteq $f10,$f31,$f1
	fbne $f1,$38
$39:
	jsr $26,abort
	ldgp $29,0($26)
	.align 4
$38:
	bis $31,$31,$0
	ldq $26,0($30)
	addq $30,48,$30
	ret $31,($26),1
	.end main
	.comm	__eh_pc,8,8
	.comm	__eh_type,8,8
	.comm	__eh_value,8,8
	.comm	__eh_cleanup,8,8
	.comm	__eh_in_catch,8,8
	.ident	"GCC: (GNU) egcs-2.90.06.1 970910 (gcc2-970802 experimental)"
# gcc foo.s
# a.out
Floating point exception (core dumped)
# gcc -O foo.cc -fno-ansi-overloading -S
# cat foo.s
	.file	1 "foo.cc"
	.version	"01.01"
	.set noat
gcc2_compiled.:
__gnu_compiled_cplusplus:
.section	.rodata
	.align 3
$C32:
	.t_floating 1.00000000000000000000e0
.text
	.align 3
	.globl main
	.ent main
main:
	ldgp $29,0($27)
main..ng:
	lda $30,-16($30)
	.frame $30,16,$26,0
	.prologue 1
	lda $1,$C32
	ldt $f1,0($1)
	stt $f1,0($30)
	stq $31,8($30)
	bis $31,$31,$0
	addq $30,16,$30
	ret $31,($26),1
	.end main
	.comm	__eh_pc,8,8
	.comm	__eh_type,8,8
	.comm	__eh_value,8,8
	.comm	__eh_cleanup,8,8
	.comm	__eh_in_catch,8,8
	.ident	"GCC: (GNU) egcs-2.90.06.1 970910 (gcc2-970802 experimental)"
# gcc foo.s
# a.out


-- 
H.J. Lu (hjl@gnu.ai.mit.edu)
---foo.cc--
class complex_double
{
public:
  complex_double (double r = 0, double i = 0): re (r), im (i) { }
  double re, im;
};

main()
{
  complex_double one = 1.0;
  if (one.re != 1.0 || one.im != 0.0)
    abort ();

  return 0;
}



More information about the Gcc mailing list