| 1 | // RUN: %clang -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK |
|---|---|
| 2 | |
| 3 | #include <stdint.h> |
| 4 | |
| 5 | int main() { |
| 6 | // CHECK-NOT: implicit-conversion |
| 7 | |
| 8 | // Explicitly casting hides it, |
| 9 | int8_t n0 = (int8_t)((uint32_t)-1); |
| 10 | |
| 11 | // Positive tests. |
| 12 | int8_t t0 = (uint32_t)-1; |
| 13 | // CHECK: implicit-conversion by 0x{{[[:xdigit:]]+$}} |
| 14 | // CHECK-NOT: implicit-conversion |
| 15 | |
| 16 | return 0; |
| 17 | } |
| 18 |
