forcing a variable to be on the stack

Andrew Haley aph@redhat.com
Wed Oct 6 15:21:00 GMT 2010


On 10/06/2010 04:11 PM, Mathieu Lacage wrote:
> Is there a way to ask gcc to force a specific variable to be stored on
> the stack ?

Take its address.

> (other than write a bit of inline asm ?)

Nothing wrong with that:

 asm volatile ("" ::"a"&foo);

Andrew.



More information about the Gcc-help mailing list