[Bug optimization/12209] [3.4 Regression] GCC fails to bootstrap Cygwin with -funit-at-a-time
rmathew at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Oct 9 07:09:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12209
------- Additional Comments From rmathew at hotmail dot com 2003-10-09 07:09 -------
Honza, this bug is similar to the problem that
Mohan had with -funit-at-a-time and bootstrap
for MinGW and that I sent you a mail some time
back about ("Re: New MingW 3.4 Build").
Win32 compilers emit a call to _chkstk( )
as a part of a method prologue whenever
the local variables' size in the method
exceeds CHECK_STACK_LIMIT ( == 4K).
This method is defined in "gcc/config/i386/cygwin.asm"
for both CygWin and MinGW and seems to
expect the total size of the locals in
EAX.
The call to _chkstk( ) is emitted as a
part of ix86_expand_prologue( ) in
"gcc/config/i386/i386.c" - see the
"else condition" with the comment
"/* ??? Is this only valid for Win32? */".
This worked fine till "-funit-at-a-time"
came along - in particular, AFAICT,
ix86_function_regparm( ) in "gcc/config/i386/i386.c"
has the code (in the third inner "if" block
inside the first outer "if" block) that
converts a local function into a
regparm(3) function. regparm(3) seems
to use EAX in addition to ECX and EDX
that "fastcall" uses, which conflicts
with _chkstk( ) as described above and
results in clobbered arguments to methods.
IMHO, the fix could be to unconditionally
convert such functions only to regparm(2)
or use a marker in the function's decl
that says that it would require stack
limit to be checked and hence can only be
converted to a regparm(2) function.
Another, possibly better, fix would be
to change ix86_expand_prologue( ) and
_chkstk( ) to use another register to
communicate the allocation size information.
I do not know how feasible this is on
a register starved architecture like
the x86-32 though.
Ranjit.
More information about the Gcc-bugs
mailing list