[Bug middle-end/64920] bootstrap-ubsan [build/gengtype -r gtype.state]: libiberty/regex.c:6970:11: runtime error: left shift of negative value -1
zeccav at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Sep 17 18:12:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64920
--- Comment #2 from Vittorio Zecca <zeccav at gmail dot com> ---
I propose the following fix at line 688 of regex.c in trunk
change
(destination) += SIGN_EXTEND_CHAR (*((source) + 1)) << 8 ; \
into
(*((source) + 1)) >= 0 ? (destination) += SIGN_EXTEND_CHAR (*((source) + 1)) <<
8 : (destination) ; \
I admit I did not tested it (yet) but the idea is to shift only if the shiftee
is not negative
More information about the Gcc-bugs
mailing list