There is a bug on the tree optimization code generated by gcc that produces corruption of variables on some corner cases of code generated by Linux kernel for ARM. I originally found the bug on codesourcery releases but was able to reproduced it on gcc 4.1 that I builded.
Detailed explanation and some insights from codesourcery guys can be found at this mail thread: http://www.codesourcery.com/archives/arm-gnu/msg00961.html The example code that triggers the bug is found there too. -- Summary: Tree optimization extends variable life of variable beyond original declared Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: major Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: diego dot dompe at ridgerun dot com GCC build triplet: x86_64-pc-linux-gnu GCC host triplet: x86_64-pc-linux-gnu GCC target triplet: arm-linux-uclibcgnueabi http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29877