1 // RUN: %clangxx -fsanitize=pointer-overflow %s -o %t 2 // RUN: %run %t 1 2>&1 | FileCheck %s --check-prefix=ERR 3 // RUN: %run %t 0 2>&1 | FileCheck %s --check-prefix=SAFE 4 // RUN: %run %t -1 2>&1 | FileCheck %s --check-prefix=SAFE 5 6 #include <stdio.h> 7 #include <stdint.h> 8 #include <stdlib.h> 9 10 int main(int argc, char *argv[]) { 11 // SAFE-NOT: runtime error 12 // ERR: runtime error: pointer index expression with base {{.*}} overflowed to 13 14 char *p = (char *)(UINTPTR_MAX); 15 16 printf("%p\n", p + atoi(argv[1])); 17 18 return 0; 19 } 20