1 // RUN: %clang_scudo %s -o %t 2 // RUN: not %run %t pointers 2>&1 | FileCheck %s 3 4 // Tests that a non-16-byte aligned pointer will trigger the associated error 5 // on deallocation. 6 7 #include <assert.h> 8 #include <malloc.h> 9 #include <stdint.h> 10 #include <stdlib.h> 11 #include <string.h> 12 main(int argc,char ** argv)13int main(int argc, char **argv) 14 { 15 assert(argc == 2); 16 if (!strcmp(argv[1], "pointers")) { 17 void *p = malloc(1U << 16); 18 if (!p) 19 return 1; 20 free(reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(p) | 8)); 21 } 22 return 0; 23 } 24 25 // CHECK: ERROR: attempted to deallocate a chunk not properly aligned 26