http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56881
devspam at moreofthesa dot me.uk changed: What |Removed |Added ---------------------------------------------------------------------------- Target| |amd64 Known to work| |4.7.2 Host| |amd64 Version|unknown |4.8.0 Known to fail| |4.8.0 --- Comment #2 from devspam at moreofthesa dot me.uk 2013-04-09 13:57:08 UTC --- (In reply to comment #1) > IMHO, if domalloc() does return NULL for some cases, > having NULL-checking statement before/inside memmove is required. It doesn't return NULL – if malloc() returns null, domalloc() will report that and exit. But even if it did, that doesn't explain the problem occurring only at some optimisation levels. Anyway. I've done some more testing. The problem is (or is related to) -fcaller-saves: -O2 and -Os both trigger the problem, but add -fno-caller-saves and all is well.