VRP miscompiles the following testcase at -O2:
#include <stdlib.h> void test(int x, int y) { int c; if (x == 1) abort(); if (y == 1) abort(); c = x / y; if (c != 1) abort(); } int main() { test(2, 2); } The t27.vrp dump shows what happens: ... c_3: ~[1, 1] EQUIVALENCES: { } (0 elements) x_4: ~[1, 1] EQUIVALENCES: { x_1 } (1 elements) y_5: ~[1, 1] EQUIVALENCES: { y_2 } (1 elements) Folding predicate c_3 != 1 to 1 ... VRP concludes that since x != 1 and y != 1, then x / y != 1, which is clearly incorrect. This results in the last abort being made unconditional. -- Summary: VRP propagates division of antiranges incorrectly Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rmorganl at u dot washington dot edu CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i686-pc-cygwin GCC host triplet: i686-pc-cygwin GCC target triplet: i686-pc-cygwin http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23129