https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66311
--- Comment #14 from Mikael Morin <mikael at gcc dot gnu.org> --- (In reply to rsand...@gcc.gnu.org from comment #12) > Created attachment 36128 [details] > Alternative patch > > Here's an alternative patch. I haven't yet tested it beyond > an expanded version of the testcase, but I think it's easier > to follow if we separate the "val != valres" and "need an extra > zero block" logic. Looks cleaner indeed. :-) I'm still worried by the case where x is negative and fits in wide_int, but its absolute value doesn't. It's somehow the same as this case, except that the boundary is at the size of wide_int (whatever it is) instead of 64 bits (the size of HOST_WIDE_INT) in this case. Not sure it matters.