On 2006-12-09, David Dyck <[email protected]> wrote:

>> I'm having trouble with mspgcc version 3.2.3 accessing a variable
>> that's been declared as volatile twice, when my code refers to it
>> only once.
[...]
>> Note that the code is accessing the switch variable twice, in the cmp
>> instruction at 0xfc46 and in the mov instruction at 0xfc4c.
>> This is fairly problematic, since when I switch on the value of I2CIV
>> in my I2C interrupt function I miss a large number of interrupts!
>
> I'm guessing you weren't optimizing your example code

That's moot.  The generated code is incorrect[1].  Compilers are not
permitted to generate incorrect code regardless of optimization
settings.

[1] Unless I misunderstood the C standard's requirement for
    the implementation of volatile variables.

-- 
Grant Edwards                   grante             Yow!  When this load is
                                  at               DONE I think I'll wash
                               visi.com            it AGAIN...


Reply via email to