This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/81588] New: Wrong code at -O2
- From: "babokin at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 27 Jul 2017 17:46:38 +0000
- Subject: [Bug tree-optimization/81588] New: Wrong code at -O2
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81588
Bug ID: 81588
Summary: Wrong code at -O2
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: babokin at gmail dot com
Target Milestone: ---
gcc trunk, rev250630, x86_64.
> cat f.cpp
#include <stdio.h>
long int var_34 = 5011877430933453486L;
unsigned short var_82 = 24847;
long int var_58 = 1;
void foo() {
if (var_82 > var_34 ^ true + (var_34 < 0))
var_58 = 0;
}
int main() {
foo();
printf("%ld\n", var_58);
return 0;
}
> g++ -O0 f.cpp -o out; ./out
0
> g++ -O2 f.cpp -o out; ./out
1