File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -18,10 +18,18 @@ AllocationsTestSuite.test("absurd.allocation.misaligned") {
18
18
19
19
AllocationsTestSuite . test ( " absurd.allocation.gargantuan " ) {
20
20
expectCrashLater ( )
21
+ // There is a chance that we'll actually be able to allocate Int.max bytes on
22
+ // 32-bit platforms, since they often have 4GB address spaces and Int.max is
23
+ // 2GB minus one byte. Allocate twice to ensure failure. That will (attempt
24
+ // to) allocate 4GB minus two bytes, and we'll definitely have more than two
25
+ // bytes of other stuff in the process.
21
26
let mustFail = UnsafeMutableRawPointer . allocate ( byteCount: Int . max,
22
27
alignment: 0 )
28
+ let mustFail2 = UnsafeMutableRawPointer . allocate ( byteCount: Int . max,
29
+ alignment: 0 )
23
30
expectUnreachable ( )
24
31
_ = mustFail
32
+ _ = mustFail2
25
33
}
26
34
27
35
runAllTests ( )
You can’t perform that action at this time.
0 commit comments