This repository has been archived by the owner on Apr 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SwiftREPL] Runtime checks for exclusive access should trap.
<rdar://problem/33831489>
- Loading branch information
Davide Italiano
committed
Jan 7, 2019
1 parent
305face
commit d0c9406
Showing
2 changed files
with
28 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Runtime checks for exclusive access should be enabled in the REPL. | ||
|
||
// RUN: %lldb --repl < %s 2>&1 | FileCheck %s | ||
// CHECK: modification requires exclusive access | ||
// CHECK: Execution interrupted | ||
|
||
class C { | ||
var f = 12 | ||
} | ||
|
||
let c = C() | ||
|
||
func doIt(_ p1: inout Int, _ p2: inout Int) { } | ||
|
||
let RTLD_DEFAULT = UnsafeMutableRawPointer(bitPattern: -2) | ||
let flagPtr = dlsym(RTLD_DEFAULT, "_swift_disableExclusivityChecking") | ||
let flagValue = flagPtr!.load(as: Bool.self) | ||
|
||
print("flagValue is \(flagValue)") | ||
doIt(&c.f, &c.f) // This should trap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters