[druntime-test] memoryerror_stackoverflow.d: Prevent hangs with >=llv…#4969
Closed
the-horo wants to merge 1 commit intoldc-developers:masterfrom
Closed
[druntime-test] memoryerror_stackoverflow.d: Prevent hangs with >=llv…#4969the-horo wants to merge 1 commit intoldc-developers:masterfrom
the-horo wants to merge 1 commit intoldc-developers:masterfrom
Conversation
…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 ``` Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
Contributor
Author
|
I'm also fine backporting these upstream but I wanted to get a review from here first |
Member
|
lgtm |
Member
|
How come this doesn't show up as a CI problem? |
Contributor
Author
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 |
Contributor
Author
|
#4970 for logs on the current situation |
the-horo
added a commit
to the-horo/dmd
that referenced
this pull request
Aug 19, 2025
…tions gdc and ldc2 with llvm-20 optimize away the array declarations leading to an infinite cycle. See-Also: ldc-developers/ldc#4969 Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
thewilsonator
pushed a commit
to dlang/dmd
that referenced
this pull request
Aug 19, 2025
…tions (#21742) gdc and ldc2 with llvm-20 optimize away the array declarations leading to an infinite cycle. See-Also: ldc-developers/ldc#4969 Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
kinke
pushed a commit
that referenced
this pull request
Aug 25, 2025
…tions (dlang/dmd!21742) gdc and ldc2 with llvm-20 optimize away the array declarations leading to an infinite cycle. See-Also: #4969 Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
Member
|
This has landed from upstream now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…m-20
Since llvm-20, the stack variables are optimized away leading to an infinite loop. The affected assembly became:
Compared to the llvm-19 optimized version: