https://llvm.org/bugs/show_bug.cgi?id=23624

            Bug ID: 23624
           Summary: -fsanitize=signed-integer-overflow breaks under
                    optimization
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

$ cat tmp/ubsan-overflow/a.cc 
int one();

int main() {
  int x = one();  // 1
  int y = x - 0;  // 1
  return x - y;
}
$ cat tmp/ubsan-overflow/b.cc 
int one() { return 1; }
$ ./bin/clang++ -fsanitize=signed-integer-overflow -O1 tmp/ubsan-overflow/*.cc
&& ./a.out
tmp/ubsan-overflow/a.cc:6:12: runtime error: signed integer overflow: 1 - 0
cannot be represented in type 'int'

Seriously?

I will investigate this issue, reporting here to track progress and share the
link.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to