1 // FIXME: https://code.google.com/p/address-sanitizer/issues/detail?id=316 2 // I'm not sure this is actually *that* issue, but this seems oddly similar to the other XFAIL'ed cases. 3 // UNSUPPORTED: android 4 // UNSUPPORTED: ios 5 6 // RUN: %clang -x c -fsanitize=alignment -O0 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:" 7 // RUN: %clang -x c -fsanitize=alignment -O1 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:" 8 // RUN: %clang -x c -fsanitize=alignment -O2 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:" 9 // RUN: %clang -x c -fsanitize=alignment -O3 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:" 10 11 // RUN: %clang -x c++ -fsanitize=alignment -O0 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:" 12 // RUN: %clang -x c++ -fsanitize=alignment -O1 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:" 13 // RUN: %clang -x c++ -fsanitize=alignment -O2 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:" 14 // RUN: %clang -x c++ -fsanitize=alignment -O3 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:" 15 16 char **__attribute__((alloc_align(2))) 17 passthrough(char **x, unsigned long alignment) { 18 return x; 19 } 20 21 unsigned long alignment; 22 23 int main(int argc, char* argv[]) { 24 alignment = 0x80000000; 25 26 passthrough(argv, alignment); 27 // CHECK: {{.*}}alignment-assumption-{{.*}}.cpp:[[@LINE-1]]:3: runtime error: assumption of 2147483648 byte alignment for pointer of type 'char **' failed 28 // CHECK: {{.*}}alignment-assumption-{{.*}}.cpp:[[@LINE-12]]:23: note: alignment assumption was specified here 29 // CHECK: 0x{{.*}}: note: address is {{.*}} aligned, misalignment offset is {{.*}} byte 30 31 return 0; 32 } 33