BIB merge Ada regression [more info]

Laurent Guerby guerby@acm.org
Mon Dec 16 16:54:00 GMT 2002


The assembly generated at -O2 from my small piece of code looks silly:
the pointer to function parameter of index2 is expected to be in %eax
however there is no move from the stack to %eax hence the blowup. At -O1
the stack to %eax move is still there and things do work.

Time to sleep :).

-- 
Laurent Guerby <guerby@acm.org>

-O2 -S

	.file	"toto.adb"
	.text
	.p2align 4,,15
	.type	toto__index2.0, @function
toto__index2.0:
	pushl	%ebp
	movl	%esp, %ebp
	subl	$24, %esp
	movb	$97, (%esp)
	movl	%ecx, -4(%ebp)
	call	*%eax
	leave
	cmpb	$97, %al
	sete	%al
	movzbl	%al, %eax
	ret
	.size	toto__index2.0, .-toto__index2.0
	.p2align 4,,15
.globl _ada_toto
	.type	_ada_toto, @function
_ada_toto:
	pushl	%ebp
	movl	%esp, %ebp
	movl	%ebp, %ecx
	subl	$8, %esp
	movl	$toto_p__map_to_lower_case, (%esp)
	call	toto__index2.0
	leave
	ret
	.size	_ada_toto, .-_ada_toto
	.ident	"GCC: (GNU) 3.4 20021216 (experimental)"

-O1 -S

	.file	"toto.adb"
	.section	.rodata
.LC0:
	.string	"toto.adb"
	.zero	1
	.text
	.type	toto__index2.0, @function
toto__index2.0:
	pushl	%ebp
	movl	%esp, %ebp
	subl	$24, %esp
	movl	%ecx, -4(%ebp)
	movl	8(%ebp), %eax
	testl	%eax, %eax
	jne	.L4
	movl	$8, 4(%esp)
	movl	$.LC0, (%esp)
	call	__gnat_rcheck_00
.L4:
	movb	$97, (%esp)
	call	*%eax
	cmpb	$97, %al
	sete	%al
	movzbl	%al, %eax
	leave
	ret
	.size	toto__index2.0, .-toto__index2.0
.globl _ada_toto
	.type	_ada_toto, @function
_ada_toto:
	pushl	%ebp
	movl	%esp, %ebp
	subl	$8, %esp
	movl	$toto_p__map_to_lower_case, (%esp)
	movl	%ebp, %ecx
	call	toto__index2.0
	leave
	ret
	.size	_ada_toto, .-_ada_toto
	.ident	"GCC: (GNU) 3.4 20021216 (experimental)"



More information about the Gcc mailing list