http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51862
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |INVALID --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-15 04:46:59 UTC --- This code is undefined in that buf escapes the scope which causes the undefined behavior. { char buf[4]; unsigned int ch = strtoul(++p, &pe, 16); len = convert_UTF32_to_UTF8(buf, ch); unescape = buf; } Any use of buf after the scope closes is undefined. GCC 4.7.0 optimizes better with respect of this undefinedness.