https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65875
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 35395 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35395&action=edit gcc5-pr65875.patch Untested fix. IMHO vrp_visit_phi_node was missing the vr_result VR_VARING handling if the value range turned into varying only during update_value_range, and also update_value_range wasn't telling the caller if it changed it into varying late. That said, the testcase has conditionally undefined variable, and checking whether all the VRP decisions (first and second pass) are sane, would be nice, Richard, could you please have a look? E.g. I find it strange that h has VR [0, LONG_MAX] before VRP2, when it really has just values 0 or 1, so should be ideally [0, 1]. Or that i has value range [1, LONG_MAX] - it is conditionally undefined (that is ignored), and conditionally negation of an int variable (only if that int variable is negative). The negated int variable is [1, +INF(OVF)] because INT_MIN might overflow, perhaps if we really need to preserve the OVF flag, we have to use [1, +INF(OVF)] again rather than just [1, 0x7fffffff] :(.