Skip to content

Commit 40b2c45

Browse files
committed
Merge remote-tracking branch 'origin/main' into next
2 parents 04ae86c + 1d83fe3 commit 40b2c45

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/Concurrency/Runtime/async_taskgroup_discarding_neverConsumingTasks.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,15 @@ func test_discardingTaskGroup_bigReturn() async {
9292
let array = await withDiscardingTaskGroup { group in
9393
group.addTask {}
9494
try? await Task.sleep(until: .now + .milliseconds(100), clock: .continuous)
95-
return InlineArray<32768, Int>(repeating: 12345)
95+
96+
// InlineArray.init(repeating:) uses a lot of stack space with optimizations
97+
// disabled, so set one up in a less friendly but less stack-consuming way.
98+
let ptr = UnsafeMutablePointer<InlineArray<32768, Int>>.allocate(capacity: 1)
99+
ptr.withMemoryRebound(to: Int.self, capacity: 32768) {
100+
$0.initialize(repeating: 12345, count: 32768)
101+
}
102+
// Deliberately leak `ptr` to avoid needing to save any temporaries.
103+
return ptr.pointee
96104
}
97105

98106
// CHECK: Huge return value produced: 12345 12345

0 commit comments

Comments
 (0)