https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87415
Aldy Hernandez <aldyh at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |aldyh at gcc dot gnu.org --- Comment #2 from Aldy Hernandez <aldyh at gcc dot gnu.org> --- All mine baby! For a 1-bit signed field we are trying to subtract the following ranges: [0, 0] - VR_VARYING Mathematically these are: [0, 0] - [MIN, MAX] => [0, 0] - [-1, 0] [Because 1-bit signed fields go from -1 to 0, supposedly to make two's complement work, but really to piss me off.] For ranges: [a, b] - [c, d] is [a - d, b - c], so combine_bounds() yields: [0, OVERFLOW] Then we adjust the result for overflows in set_value_range_with_overflow() we transform the above into: [0, +INF] And since +INF is 0, we get [0, 0] which is incorrect. [0, 0] - [MIN, MAX] should have given [MIN, MAX]. I'm still trying to work this out without special casing 1-bit fields. But the original patch is correct-- perhaps we should adjust set_value_range_with_overflow... not sure yet.