File tree Expand file tree Collapse file tree 4 files changed +46
-3
lines changed
PlaygroundTransform/Inputs Expand file tree Collapse file tree 4 files changed +46
-3
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: dffedaa1888ef755e9e933a2cf0bb0185aa31c47
2
+ refs/heads/master: 9e0d07eefc1cbecd1f8d97086dfe304490e28c16
3
3
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
4
4
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
5
5
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea
Original file line number Diff line number Diff line change @@ -1162,7 +1162,10 @@ extension Array: RangeReplaceableCollection {
1162
1162
" newElements.underestimatedCount was an overestimate " )
1163
1163
// can't check for overflow as sequences can underestimate
1164
1164
1165
- _buffer. count += writtenCount
1165
+ // This check prevents a data race writting to _swiftEmptyArrayStorage
1166
+ if writtenCount > 0 {
1167
+ _buffer. count += writtenCount
1168
+ }
1166
1169
1167
1170
if writtenUpTo == buf. endIndex {
1168
1171
// there may be elements that didn't fit in the existing buffer,
Original file line number Diff line number Diff line change 7
7
sys .exit (0 )
8
8
9
9
try :
10
- subprocess .check_call (shlex .split (' ' . join ( sys .argv [1 :]) ))
10
+ subprocess .check_call (shlex .split (sys .argv [1 ] ))
11
11
sys .exit (1 )
12
12
except subprocess .CalledProcessError as e :
13
13
sys .exit (0 )
Original file line number Diff line number Diff line change
1
+ // RUN: %target-swiftc_driver %s -target %sanitizers-target-triple -g -sanitize=thread -o %t_tsan-binary
2
+ // RUN: %target-codesign %t_tsan-binary
3
+ // RUN: %target-run %t_tsan-binary 2>&1 | %FileCheck %s
4
+ // REQUIRES: executable_test
5
+ // REQUIRES: tsan_runtime
6
+ // UNSUPPORTED: OS=tvos
7
+
8
+ // FIXME: This should be covered by "tsan_runtime"; older versions of Apple OSs
9
+ // don't support TSan.
10
+ // UNSUPPORTED: remote_run
11
+
12
+ import Foundation
13
+
14
+ let sem = DispatchSemaphore ( value: 0 )
15
+
16
+ class T1 : Thread {
17
+ override func main( ) {
18
+ var oneEmptyArray : [ [ String : String ] ] = [ ]
19
+ oneEmptyArray. append ( contentsOf: [ ] )
20
+ sem. signal ( )
21
+ }
22
+ }
23
+ let t1 = T1 ( )
24
+ t1. start ( )
25
+
26
+ class T2 : Thread {
27
+ override func main( ) {
28
+ var aCompletelyUnrelatedOtherEmptyArray : [ [ Double : Double ] ] = [ ]
29
+ aCompletelyUnrelatedOtherEmptyArray. append ( contentsOf: [ ] )
30
+ sem. signal ( )
31
+ }
32
+ }
33
+ let t2 = T2 ( )
34
+ t2. start ( )
35
+
36
+ sem. wait ( )
37
+ sem. wait ( )
38
+ print ( " Done! " )
39
+
40
+ // CHECK: Done!
You can’t perform that action at this time.
0 commit comments