This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Stack alignment ? in latest ss


Content-Type: text/plain; charset=us-ascii
Content-Description: message body text
Content-Transfer-Encoding: 7bit


I tried Stephen Johnson's stack alignment test (reproduced below) on
this week's snapshot, built on an i686-linux-gnu [I uploaded
testresults to the testresults list].  I tried building the test
program with various combinations of flags; e.g.,

/usr/bin/gcc -OX -malign-functions=Y -malign-loops=Y -malign-jumps=Y stack2.c 

where X=0,2,3 and Y=2,3.  a.out fails, reporting

one 1
Abort

Can someone provide an update on this problem?

Thanks

David

int one(int count)
{
     double foobar;
     if ((((long) &foobar) & 0x7L)) {
          printf("one %d\n", count);
          abort();
     }
     return 1;
}

void blah(int foo)
{
     double foobar;
     if ((((long) &foobar) & 0x7L)) {
          printf("blah\n");
          abort();
     }
}

int main(void)
{
     one(1);
     blah(one(2));
     return 0;
}


# 1 "stack2.c"
int one(int count)
{
     double foobar;
     if ((((long) &foobar) & 0x7L)) {
          printf("one %d\n", count);
          abort();
     }
     return 1;
}

void blah(int foo)
{
     double foobar;
     if ((((long) &foobar) & 0x7L)) {
          printf("blah\n");
          abort();
     }
}

int main(void)
{
     one(1);
     blah(one(2));
     return 0;
}
	.file	"stack2.c"
	.version	"01.01"
gcc2_compiled.:
	.section	.rodata
.LC0:
	.string	"one %d\n"
.LC1:
	.string	"blah"
	.text
	.align 4
.globl one
	.type	one,@function
one:
	pushl	%ebp
	movl	%esp, %ebp
	subl	$8, %esp
	testl	$4, %ebp
	jne	.L13
	movl	$1, %eax
	movl	%ebp, %esp
	popl	%ebp
	ret
	.p2align 2
.L13:
	movl	8(%ebp), %eax
	pushl	%eax
	pushl	$.LC0
	call	printf
	call	abort
.Lfe1:
	.size	one,.Lfe1-one
	.align 4
.globl blah
	.type	blah,@function
blah:
	pushl	%ebp
	movl	%esp, %ebp
	subl	$8, %esp
	testl	$4, %ebp
	jne	.L14
	movl	%ebp, %esp
	popl	%ebp
	ret
	.p2align 2
.L14:
	pushl	$.LC1
	call	puts
	call	abort
.Lfe2:
	.size	blah,.Lfe2-blah
	.align 4
.globl main
	.type	main,@function
main:
	pushl	%ebp
	movl	%esp, %ebp
	subl	$64, %esp
	testl	$4, %ebp
	jne	.L15
	testl	$4, %ebp
	jne	.L16
	testl	$4, %ebp
	jne	.L17
	xorl	%eax, %eax
	movl	%ebp, %esp
	popl	%ebp
	ret
	.p2align 2
.L15:
	pushl	$1
	pushl	$.LC0
	call	printf
	call	abort
	.p2align 2
.L16:
	pushl	$2
	pushl	$.LC0
	call	printf
	call	abort
	.p2align 2
.L17:
	pushl	$.LC1
	call	puts
	call	abort
.Lfe3:
	.size	main,.Lfe3-main
	.ident	"GCC: (GNU) 2.97 20001030 (experimental)"

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]