This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/81588] New: Wrong code at -O2


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]