This bug is seen using the avr-gcc that is built using the script that comes with FemtoOS 0.88.
Compile the attached program like this: avr-gcc -O -mmcu=atmega128 small.c -S It can be seen that func_45() unconditionally loads from volatile g_54. That is wrong, since in the C code the load is protected by a test. -- Summary: volatile bug on AVR Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: regehr at cs dot utah dot edu GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: avr http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39223