http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54014
Bug #: 54014 Summary: Value Range propagation bug Classification: Unclassified Product: gcc Version: 4.5.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: ferra...@elet.polimi.it Created attachment 27822 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27822 sightly modified version of arith-rand.c Dears, I've found a problem with a sightly modified version of a gcc regression test (arith-rand.c). The regression test has been modified in order to abort on a specific condition. The test correctly aborts when no optimization is performed but it does not fail when -O2 is passed. The problem seems to be in how the VRP work, in fact once the -fno-tree-vrp is passed the test correctly fails. The line I've added to arith-rand.c is the following if((unsigned int) ABS (yy)==2147483648u) abort(); The VRP claims that (unsigned int) ABS (yy) is in the range [1, 2147483647] but the actual range should be [1, 2147483648]. Everything seems to be related to the managing of -(-2147483648). The test does not abort on these versions on gcc-4.5.3 (Ubuntu 12.04), 4.6.3 (Ubuntu 12.04) and on gcc-4.7.1 (debian wheezy/sid) with the following command line: gcc-4.5 arith-rand.c -O2 #(Ubuntu 12.04) gcc-4.5 arith-rand.c -O2 #(Ubuntu 12.04) gcc-4.7 arith-rand.c -O2 #(debian wheezy/sid) while it correctly aborts once the option -fno-tree-vrp is passed Cheers, Fabrizio