https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110731
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- This should have done the negative (in the original patch): 1796 /* The quotient is neg if exactly one of the divisor or dividend is 1797 neg. */ 1798 if (dividend_neg != divisor_neg) 1799 quotient_len = wi::sub_large (quotient, zeros, 1, quotient, 1800 quotient_len, dividend_prec, 1801 UNSIGNED, 0); That is you do -((332306998946228968225951765070086143wb + 1)/2)