This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/50115] New: Integer test optimised away at -O2 by the VRP
- From: "balint at szentedwg dot ro" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 18 Aug 2011 09:55:52 +0000
- Subject: [Bug c++/50115] New: Integer test optimised away at -O2 by the VRP
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50115
Bug #: 50115
Summary: Integer test optimised away at -O2 by the VRP
Classification: Unclassified
Product: gcc
Version: 4.5.1
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: balint@szentedwg.ro
Created attachment 25047
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25047
Preprocessed file with Suse's GCC 4.5.1
The value == numeric_limits<int>::min() test will be always considered false in
the attached preprocessed files using -O2 with G++ v4.5 and up.
Steps to reproduce:
$ g++ -o vrp-bug vrp-bug.cpp -O2
$ ./vrp-bug
$ echo $?
Expected result:
0
Actual result:
1
G++ versions affected:
4.5 and up (4.4.5 for example is working well).
Additional info:
The compiler considers for some reason "value" not equal with
numeric_limits<int>::min(), and simply generates only the else branch of the
"if".
The -fno-tree-vrp fixes the problem, it seems VRP takes wrong decision at
compile time.
See the attached preprocessed source codes with the corresponding G++ version
logs.