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") {
1818
1919AllocationsTestSuite . test ( " absurd.allocation.gargantuan " ) {
2020 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.
2126 let mustFail = UnsafeMutableRawPointer . allocate ( byteCount: Int . max,
2227 alignment: 0 )
28+ let mustFail2 = UnsafeMutableRawPointer . allocate ( byteCount: Int . max,
29+ alignment: 0 )
2330 expectUnreachable ( )
2431 _ = mustFail
32+ _ = mustFail2
2533}
2634
2735runAllTests ( )
You can’t perform that action at this time.
0 commit comments