http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54471
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED AssignedTo|unassigned at gcc dot |jakub at gcc dot gnu.org |gnu.org | --- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-11-21 14:42:13 UTC --- Created attachment 28755 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28755 gcc48-pr54471.patch Untested fix. I believe the bug is in invalid canonicalization. When sizem1 is { -1, -1 } double_int, sizem1 + double_int_one is { 0, 0 }, as it wrapped, instead of { 0, 0, 1, 0 } quad_int. And if min0 or min1 is zero, then size - min{0,1} is also zero, and so is very likely smaller than max{0,1} (unless min{0,1} == max{0,1}), but we still don't want to "canonicalize" that to signed. IMHO testing min2.is_zero () is sufficient, as min0 or min1 should be a valid double_int in the range 0 to { -1, -1 }, which is always smaller than the maximum unsigned integer + 1 in infinite precision and thus min2 should never be zero, unless size overflowed to 0 and min{0,1} is zero.