https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118953
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- So, I think this is incorrect handling of the masks/values during range union. As written earlier, we have # RANGE [irange] long long unsigned int [0, +INF] MASK 0xffffffffffffc000 VALUE 0x2d _3 = _2 + 18446744073708503085; and # RANGE [irange] long long unsigned int [0, +INF] MASK 0xffffffffffffc000 VALUE 0x59 _6 = (long long unsigned int) _5; # RANGE [irange] int [-INF, +INF] MASK 0xffffc000 VALUE 0x34 _7 = k_11 + -1048524; from ccp, those are correct. Now, when processing the PHI, we iterate over the PHI arguments, the first one is _3 and we figure out that to reach that edge _7 has to be 24 or 32 and as 0x34 - 0x2d is 7, that implies [irange] long long unsigned int [17, 17][25, 25] MASK 0xffffffffffffc000 VALUE 0x2d That is already in itself inconsistent, obviously when it has value of 17, then for the given MASK VALUE is 0x11 rather than 0x2d and for 25 the VALUE is 0x19. Anyway, the second PHI argument is 0, and union_ of [irange] long long unsigned int [17, 17][25, 25] MASK 0xffffffffffffc000 VALUE 0x2d and [irange] long long unsigned int [0, 0] results in incorrect [irange] long long unsigned int [0, 0][17, 17][25, 25] MASK 0xffffffffffffc000 VALUE 0x2d While the weird earlier range was perhaps ok because it was really from an unreachable edge, [0, 0] is from an reachable edge, so it should have adjusted the MASK and VALUE accordingly, so that 0 is a valid value there. And finally we union that with the [irange] long long unsigned int [45, 45] which is again questionable (the edge is unreachable though), 45 is 8 + 1048524 - 1048487 where 8 is the case value (the only one) and the two numbers are what is subtracted from k_11 to reach _7 and _6. MASK 0xffffffffffffc000 VALUE 0x59 is clearly ignored in that case. Anyway, we get [irange] long long unsigned int [0, 0][17, 17][25, 25][45, 45] MASK 0xffffffffffffc000 VALUE 0x2d and bet something later figures out that for this to be true, only [45, 45] is acceptable.