You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
624 B
23 lines
624 B
// RUN: %clang -fsanitize=pointer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-C --implicit-check-not="pointer-overflow"
|
|
// RUN: %clangxx -fsanitize=pointer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-CPP --implicit-check-not="pointer-overflow"
|
|
|
|
#include <stdlib.h>
|
|
|
|
int main(int argc, char *argv[]) {
|
|
char *base, *result;
|
|
|
|
base = (char *)0;
|
|
result = base + 0;
|
|
// CHECK-C: pointer-overflow
|
|
|
|
base = (char *)0;
|
|
result = base + 1;
|
|
// CHECK: pointer-overflow
|
|
|
|
base = (char *)1;
|
|
result = base - 1;
|
|
// CHECK: pointer-overflow
|
|
|
|
return 0;
|
|
}
|