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