http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56881
Mikael Pettersson <mikpe at it dot uu.se> changed: What |Removed |Added ---------------------------------------------------------------------------- CC|mikpe at it dot uu.se | --- Comment #8 from Mikael Pettersson <mikpe at it dot uu.se> 2013-04-14 08:56:47 UTC --- The error is in the test case. It overrides the libc memmove() with its own implementation, but that implementation fails to follow the specification. In particular, it returns NULL rather than memmove()'s first parameter. GCC now optimizes based on this aspect of the specification, so things go wrong at runtime. Correcting the test case as follows allows it to work with gcc 4.8 and 4.9: --- unix.c.~1~ 2013-03-06 23:17:26.000000000 +0100 +++ unix.c 2013-04-14 10:45:24.651407693 +0200 @@ -110,7 +110,7 @@ memmove(void *dp, const void *sp, size_t unsigned char *cdp, *csp; if (n<=0) - return 0; + return dp; cdp = dp; csp = (unsigned char *)sp; if (cdp < csp) { @@ -124,6 +124,6 @@ memmove(void *dp, const void *sp, size_t *--cdp = *--csp; } while (--n); } - return 0; + return dp; } #endif Not a bug in GCC. Please close as INVALID.