https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78969
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2017-05-23 Ever confirmed|0 |1 Known to fail| |7.1.0 --- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> --- (In reply to Sergei Trofimovich from comment #4) > Found similar false positive on lxc project. Thanks for the test case. The VRP pass computes the correct range information for the argument but the range made available outside it via the get_range_info() function is that of idx_6, not idx_10 below (compile with -fdump-tree-vrp=/dev/stdout to see the output). It's possible that this problem is caused by the same underlying limitation as the one in comment #0. Let me confirm this bug on that basis. Value ranges after VRP: idx_1: [1, 999] EQUIVALENCES: { idx_6 } (1 elements) idx_6: [1, 1000] idx_10: [0, 999] .MEM_11: VARYING Removing basic block 5 f (char * p) { int idx; <bb 2> [1.00%]: <bb 3> [99.00%]: # idx_10 = PHI <idx_6(3), 0(2)> __builtin_snprintf (p_4(D), 4, "%d", idx_10); idx_6 = idx_10 + 1; if (idx_6 != 1000) goto <bb 3>; [98.99%] else goto <bb 4>; [1.01%] <bb 4> [1.00%]: return; }