https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80513
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Richard Smith from comment #1) > While we're here, this check for overflow in consume_count is nonsense, and > any decent optimising compiler is going to optimise away the overflow check: > > https://github.com/gcc-mirror/gcc/blob/master/libiberty/cplus-dem.c#L525 > > Testcase: > > $ echo '_Z4294967297x' | c++filt > x > > Oops. That overflow happens in d_number in cp-demangle.c, so that check isn't used for your testcase. So we need to add a (not nonsense) check for overflow in d_number, and fix the one in consume_count.