Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / ubsan_minimal / TestCases / nullptr-and-nonzero-offset.c
blob2077e7d47b4d3c4cc707fbea3ccefcf16d169494
1 // RUN: %clang -fsanitize=pointer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-C --implicit-check-not="pointer-overflow"
2 // RUN: %clangxx -x c++ -fsanitize=pointer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-CPP --implicit-check-not="pointer-overflow"
4 #include <stdlib.h>
6 int main(int argc, char *argv[]) {
7 char *base, *result;
9 base = (char *)0;
10 result = base + 0;
11 // CHECK-C: pointer-overflow by 0x{{[[:xdigit:]]+$}}
12 // CHECK-CPP-NOT: pointer-overflow
14 base = (char *)0;
15 result = base + 1;
16 // CHECK: pointer-overflow by 0x{{[[:xdigit:]]+$}}
18 base = (char *)1;
19 result = base - 1;
20 // CHECK: pointer-overflow by 0x{{[[:xdigit:]]+$}}
22 return 0;