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

source code of compiler-rt/test/scudo/alignment.c