avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] Problem with delay loop


From: David Brown
Subject: Re: [avr-gcc-list] Problem with delay loop
Date: Mon, 01 Oct 2007 14:43:20 +0200
User-agent: Thunderbird 2.0.0.6 (Windows/20070728)

Graham Davies wrote:
David Brown wrote (in part):
"... since the local variable is volatile,
it has to be put on the stack."

I don't see how that follows (if it is declared automatic and is of local scope).

Graham.


It would be more correct to say that since the local variable is volatile, *gcc* puts it on the stack. As you imply, there is no strict requirement that the variable is put in memory anywhere (nor is there even a strict requirement that there is a stack at all). It would be perfectly acceptable for the compiler to put such a local volatile variable in a register.

I am in fact not entirely convinced that the compiler has to generate anything at all here, even with the volatile - it could perhaps reason that since there is no way for anything outside the program to find out where the local volatile variable resides, there is no way for anything else to influence or use the variable, and therefore the "volatile" qualifier can be ignored.

mvh.,

David





reply via email to

[Prev in Thread] Current Thread [Next in Thread]