mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
These tests are marked XFAIL or UNSUPPORTED because either the tests: require libc annotation, require Mach-O support, don't recognize calls to swift-autolink-extract, requires porting alongside Linux, or rely on simd which is not present. Additionally, explicit REQUIRES for tsan/asan/fuzzer are added to some tests, since OpenBSD does not support these sanitizers or fuzzers, since it's nicer to mark that with REQUIRES rather than XFAIL.
18 lines
815 B
Swift
18 lines
815 B
Swift
// REQUIRES: asan_runtime
|
|
// RUN: %target-swift-frontend -emit-ir -sanitize=address -sanitize-recover=address %s | %FileCheck %s -check-prefix=ASAN_RECOVER
|
|
// RUN: %target-swift-frontend -emit-ir -sanitize=address %s | %FileCheck %s -check-prefix=ASAN_NO_RECOVER
|
|
// RUN: %target-swift-frontend -emit-ir -sanitize-recover=address %s | %FileCheck %s -check-prefix=NO_ASAN_RECOVER
|
|
|
|
// ASAN_RECOVER: declare void @__asan_loadN_noabort(
|
|
// ASAN_NO_RECOVER: declare void @__asan_loadN(
|
|
|
|
let size:Int = 128;
|
|
let x = UnsafeMutablePointer<UInt8>.allocate(capacity: size)
|
|
x.initialize(repeating: 0, count: size)
|
|
x.advanced(by: 0).pointee = 5;
|
|
print("Read first element:\(x.advanced(by: 0).pointee)")
|
|
x.deallocate();
|
|
|
|
// There should be no ASan instrumentation in this case.
|
|
// NO_ASAN_RECOVER-NOT: declare void @__asan_load
|