[Bug c/21160] how to force a variable into the stack?
pinskia at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri Apr 22 14:24:00 GMT 2005
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-04-22 14:24 -------
(In reply to comment #3)
> I have taken the address of 'ptr' and despite that, it was not excluded from the candidates
> for register allocation - or the warning occurred despite of the variable being stack allocated.
> In either case, it's a GCC bug.
No you have not taken the address, as it will not escape or otherwise. volatile in a local function is the
same as almost as a non register.
Another way to "fix" this would be do the following:
escape_function(&a);
and mark escape_function as no inline, but this might not work in the furture as we might know that
escape_function does not escape that address, the way to work around that would be make a static file
scope variable which gets assigned that pointer but even that might cause the escapeness in the future
so the only correct way is mark the variable as volatile.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21160
More information about the Gcc-bugs
mailing list