Summary: Under some circumstances (that I haven't dug further into), the first stack frame for the test looks like: `#0 0x4e6038 in __interceptor_memalign.localalias.1 ...compiler-rt/lib/asan/asan_malloc_linux.cc:113` which isn't matched by the current CHECK. Expand the CHECK to match aligned_alloc or memalign. Hopefully this should fix the PowerPC issue as well, otherwise we'll bring back the FIXME. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: srhines, kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D45281 llvm-svn: 329226
26 lines
831 B
C++
26 lines
831 B
C++
// RUN: %clangxx_asan -O0 %s -o %t
|
|
// RUN: %env_asan_opts=allocator_may_return_null=0 not %run %t 2>&1 | FileCheck %s
|
|
// RUN: %env_asan_opts=allocator_may_return_null=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NULL
|
|
|
|
// UNSUPPORTED: android
|
|
|
|
// REQUIRES: stable-runtime
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
extern void *aligned_alloc(size_t alignment, size_t size);
|
|
|
|
int main() {
|
|
void *p = aligned_alloc(17, 100);
|
|
// CHECK: ERROR: AddressSanitizer: invalid allocation alignment: 17
|
|
// CHECK: {{#0 0x.* in .*}}{{aligned_alloc|memalign}}
|
|
// CHECK: {{#1 0x.* in main .*aligned_alloc-alignment.cc:}}[[@LINE-3]]
|
|
// CHECK: SUMMARY: AddressSanitizer: invalid-allocation-alignment
|
|
|
|
printf("pointer after failed aligned_alloc: %zd\n", (size_t)p);
|
|
// CHECK-NULL: pointer after failed aligned_alloc: 0
|
|
|
|
return 0;
|
|
}
|