[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

cc -m486



I know this is a bug of GCC's, not OpenBSD's.

On OpenBSD/i386 2.4, I compiled the following C function foo().

int	foo(int x)
{
	return x + 5;
}

With `cc -O2 -S foo.c', I obtained the Code 1.
With `cc -O2 -mcpu=i486 -S foo.c', I obtained the Code 2.

Code 1.
	.file	"foo.c"
gcc2_compiled.:
___gnu_compiled_c:
.text
	.align 2
.globl _foo
	.type	 _foo,@function
_foo:
	pushl %ebp
	movl %esp,%ebp
	movl 8(%ebp),%eax
	addl $5,%eax
	leave
	ret
Lfe1:
	.size	 _foo,Lfe1-_foo

Code 2.
	.file	"foo.c"
gcc2_compiled.:
___gnu_compiled_c:
.text
	.align 4
.globl _foo
	.type	 _foo,@function
_foo:
	pushl %ebp
	movl %esp,%ebp
	movl 8(%ebp),%eax
	addl $5,%eax
	movl %ebp,%esp
	popl %ebp
	ret
Lfe1:
	.size	 _foo,Lfe1-_foo

Info says that `-m486' is a synonym for `-mcpu=i486'.  However, with
`cc -O2 -m486 -S foo.c', I did not obtain Code 2 but Code 1.

Is this a known bug?  Is there any patch?

		Kamo Hiroyasu
		[Kamo is the family name and Hiroyasu the given name.]