https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120604
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to David Binderman from comment #5) > (In reply to Uroš Bizjak from comment #4) > > Unfortunately I > > have very limited knowledge on how to fix signed overflow, so I would really > > appreciate some help here. > > Suggest use a type with more bits in it. I have seen wide-ints > used for situations like this, but I don't know if they are suitable > here. > > See trunk/gcc/wide-int.h Simply do diff = (unsigned HOST_WIDE_INT)ct - (unsigned HOST_WIDE_INT)cf; (and in the other place), or use unsigned for 'diff' in the first place.