summaryrefslogtreecommitdiff
path: root/lib/ubsan/lit_tests/Integer/negate-overflow.cpp
blob: 9a97fad16ecc11617078b36a0c96eb23ad546c33 (plain)
1
2
3
4
5
6
7
// RUN: %clang -fsanitize=signed-integer-overflow %s -o %t && %t 2>&1 | FileCheck %s

int main() {
  -unsigned(-0x7fffffff - 1); // ok
  // CHECK: negate-overflow.cpp:6:10: fatal error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
  return -(-0x7fffffff - 1);
}