This is the mail archive of the
mailing list for the GCC project.
Re: PATCH: PR target/34001: Incorrect x86 fastcall behavior
On Sun, Nov 11, 2007 at 03:21:08PM -0800, Mark Mitchell wrote:
> Richard Guenther wrote:
> >> But it isn't clear if it applies to structure/union. We tested all MS
> >> compilers we have and verified that the above doesn't apply to
> >> structure/union. To make fastcall compatible with MS compilers, we
> >> should only put scalar arguments in ECX and EDX.
> > This would be an ABI change from previous releases. Regardless of
> > whether we want to do this, an entry for the 4.3 changes document
> > should be added.
> I would suggest that this be done only on Windows, if it's for MS
> compatibility. Unless the code before is actually broken, why should
> make a incompatible ABI change? At least, we should add a switch.
>From "info gcc",
On the Intel 386, the `fastcall' attribute causes the compiler to
pass the first argument (if of integral type) in the register ECX
and the second argument (if of integral type) in the register EDX.
Subsequent and other typed arguments are passed on the stack.
The called function will pop the arguments off the stack. If the
number of arguments is variable all arguments are pushed on the
It looks like gcc document follows MS compiler and we didn't implement
it correctly. If we want to add a switch, the default should follow