Files
clang-p2996/compiler-rt/test/ubsan_minimal/TestCases/implicit-integer-sign-change.c
Igor Kudrin 84c4efbc6d [ubsan-minimal] Report the address of an error
This implements a FIXME in the runtime library and adds printing the
address at the end of the message as "by 0x123abc". The buffer for the
message is allocated on the stack in a handler, so the stack memory
consumption is slightly increased. No additional external dependencies
are added.

Differential revision: https://reviews.llvm.org/D131914
2022-09-05 14:18:25 +04:00

18 lines
422 B
C

// RUN: %clang -fsanitize=implicit-integer-sign-change %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
#include <stdint.h>
int main() {
// CHECK-NOT: implicit-conversion
// Explicitly casting hides it,
int32_t n0 = (int32_t)(~((uint32_t)0));
// Positive tests.
int32_t t0 = (~((uint32_t)0));
// CHECK: implicit-conversion by 0x{{[[:xdigit:]]+$}}
// CHECK-NOT: implicit-conversion
return 0;
}