[druntime-test] memoryerror_stackoverflow.d: Prevent hangs with >=llv…
…m-20
Since llvm-20, the stack variables are optimized away leading to an infinite loop. The affected assembly became:
Disassembly of section .text._D25memoryerror_stackoverflow1fFKG1024hZv:
0000000000000000 <_D25memoryerror_stackoverflow1fFKG1024hZv>:
0: e9 00 00 00 00 jmp 5 <_D25memoryerror_stackoverflow1fFKG1024hZv+0x5>
Disassembly of section .text._D25memoryerror_stackoverflow1gFKG1024hZv:
0000000000000000 <_D25memoryerror_stackoverflow1gFKG1024hZv>:
0: e9 00 00 00 00 jmp 5 <_D25memoryerror_stackoverflow1gFKG1024hZv+0x5>
Compared to the llvm-19 optimized version:
Disassembly of section .text._D25memoryerror_stackoverflow1fFKG1024hZv:
0000000000000000 <_D25memoryerror_stackoverflow1fFKG1024hZv>:
0: 53 push %rbx
1: 48 81 ec 00 04 00 00 sub $0x400,%rsp
8: 48 89 fe mov %rdi,%rsi
b: 48 89 e3 mov %rsp,%rbx
e: ba 00 04 00 00 mov $0x400,%edx
13: 48 89 df mov %rbx,%rdi
16: e8 00 00 00 00 call 1b <_D25memoryerror_stackoverflow1fFKG1024hZv+0x1b>
1b: 48 89 df mov %rbx,%rdi
1e: e8 00 00 00 00 call 23 <_D25memoryerror_stackoverflow1fFKG1024hZv+0x23>
23: 48 81 c4 00 04 00 00 add $0x400,%rsp
2a: 5b pop %rbx
2b: c3 ret
Disassembly of section .text._D25memoryerror_stackoverflow1gFKG1024hZv:
0000000000000000 <_D25memoryerror_stackoverflow1gFKG1024hZv>:
0: 53 push %rbx
1: 48 81 ec 00 04 00 00 sub $0x400,%rsp
8: 48 89 fe mov %rdi,%rsi
b: 48 89 e3 mov %rsp,%rbx
e: ba 00 04 00 00 mov $0x400,%edx
13: 48 89 df mov %rbx,%rdi
16: e8 00 00 00 00 call 1b <_D25memoryerror_stackoverflow1gFKG1024hZv+0x1b>
1b: 48 89 df mov %rbx,%rdi
1e: e8 00 00 00 00 call 23 <_D25memoryerror_stackoverflow1gFKG1024hZv+0x23>
23: 48 81 c4 00 04 00 00 add $0x400,%rsp
2a: 5b pop %rbx
2b: c3 ret
I'm also fine backporting these upstream but I wanted to get a review from here first
lgtm
How come this doesn't show up as a CI problem?
How come this doesn't show up as a CI problem?
It's an amazing question that I have no idea how to answer. It wouldn't be the first time CI would work while a real system would fail but this specific issue does seem weird. The release artifacts do optimize the code as expected so it does leave a question mark over how those exact artifacts managed to pass the test.
Is it ever possible that the test is not running in CI? This seems like the most plausible explanation
#4970 for logs on the current situation
This has landed from upstream now.