[Bug tree-optimization/81705] New: UBSAN: yet another false positive

babokin at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Aug 3 19:11:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81705

            Bug ID: 81705
           Summary: UBSAN: yet another false positive
           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, rev250857, x86_64.

After recent fix for #81148, this case is the last one failing UBSAN false
positive that I see on my radars.

> cat f.cpp
int var_4 = -1716607962;
int var_14 = 943738830;
volatile int a;
int main() {
//  (-(-1716607962) - 516151698) - -(9403738830)
  a = (-var_4 - 516151698) - -var_14;
  return 0;
}

> g++ -fsanitize=undefined f.cpp -o out; ./out
f.cpp:6:28: runtime error: signed integer overflow: -943738830 + -1716607962
cannot be represented in type 'int'
f.cpp:6:28: runtime error: signed integer overflow: -516151698 - 1634620504
cannot be represented in type 'int'


More information about the Gcc-bugs mailing list