This repository has been archived by the owner on Oct 12, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 421
Fix 21484: Infinite loop in core.memory : GC.{get,set,clr}Attr(const scope void*...) #3314
Merged
Conversation
This file contains 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
|
Thanks for your pull request, @Geod24! Bugzilla references
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "stable + druntime#3314" |
PetarKirov
approved these changes
Dec 16, 2020
|
Tests? |
81c2702 to
f81ad89
Compare
|
We were talking with @Geod24 on Slack PM so that's why I was quite fast with the approval, though on second thoughts I agree with @MoonlightSentinel that it would be good to cover this with a test. Otherwise the test case for the compiler bug that @Geod24 showed me was: extern (C) uint gc_setAttr( void* p, uint a ) pure nothrow;
struct Baguette
{
static uint setAttr( const scope void* p, uint a ) nothrow
{
return setAttr(cast()p, a);
}
static uint setAttr(void* p, uint a) pure nothrow
{
return gc_setAttr( p, a );
}
}
inout(void)* bug (inout(void)* ptr)
{
Baguette.setAttr(ptr, 42);
return ptr;
}
void main ()
{
auto ptr = new int*;
bug(ptr);
} |
f81ad89 to
1725690
Compare
|
Usually I would say "it doesn't make sense to test for infinite loop here", but since the function were not covered at all, I added a small test. |
1725690 to
aa599f7
Compare
…scope void*...) Those functions never worked, and would cause an infinite recursion. In a non-optimized build that would exhaust the stack and trigger a SEGV, however in the optimized build we distribute, it results in an infinite loop as tail call optimization is performed.
aa599f7 to
afec613
Compare
|
Thanks |
|
So, anything holding this back ? |
ibuclaw
approved these changes
Dec 17, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sgtm
thewilsonator
approved these changes
Dec 17, 2020
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Those functions never worked, and would cause an infinite recursion.
In a non-optimized build that would exhaust the stack and trigger a SEGV,
however in the optimized build we distribute, it results in an infinite
loop as tail call optimization is performed.