http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49211
--- Comment #3 from Nils Asmussen <n...@script-solution.de> 2011-05-30 14:47:40 UTC --- Thanks for your reply! Perhaps I miss something, but I've no idea how that should work. Regardless of whether $254 is initialized previously or not (in my case, it's a bootloader, so there is no stdlib and no crt*, but I have to do that myself), using the stack-pointer to access global variables can't work, right? Lets suppose, that the offset in main is correct. That would mean, that x is located at $254 + 8. But $254 is changed (of course) at the beginning and end of a function (and nowhere else). If func2 accesses x as well, gcc generates code to access it at $254 + 8. So, it expects it to be always at offset 8 from $254, but of course that can't work, because $254 changes.