http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56463

--- Comment #5 from Cristóbal Camarero <nakacristo at hotmail dot com> 
2013-02-27 08:19:04 UTC ---
Dominique, I think the test I found is more problematic than yours. Since in
mine, the huge value is completely independent of the ending condition. Hence
most people would expect the loop to end without care of what happens to the
accumulator variable 'a'.

Exploring the intermediate steps of my test (with gcc test.c -O2
-fdump-tree-all) I see that in test.c.119t.ivopts the condition of the loop is
changed from 'ivtmp.8_3 != 0' to 'a_25 != 1267128320', which would be correct
considering overflow.
From here the situation must be similar to Dominique's examples.
In test.c.123t.vrp2 we see that the Value Range Propagation has decided that
the ending condition never happens, probably because the ranges have no modular
considerations. The ending condition and the printf are eliminated. In a later
stage the infinite loop is substituted by an empty infinite loop.

I suppose that this is not technically a bug. However, the lack of warning IS a
bug.
And a coherent behaviour would still being a good enhancement.

Reply via email to