D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 21484 - Infinite recursion in core.memory : GC.{get,set,clr}Attr(const scope void*...)
Summary: Infinite recursion in core.memory : GC.{get,set,clr}Attr(const scope void*...)
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: druntime (show other issues)
Version: D2
Hardware: All All
: P1 major
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2020-12-16 17:48 UTC by Mathias LANG
Modified: 2020-12-21 01:01 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Mathias LANG 2020-12-16 17:48:16 UTC
```
import core.memory;
const(void)* bug (const(void)* ptr)
{
    GC.getAttr(ptr);
    return ptr;
}

void main ()
{
    auto ptr = new int*;
    bug(ptr);
}
```

Running this with `dmd -run` never terminates. Fix incoming.
Comment 1 Dlang Bot 2020-12-16 17:52:33 UTC
@Geod24 created dlang/druntime pull request #3314 "Fix 21484: Infinite loop in core.memory : GC.{get,set,clr}Attr(const scope void*...)" fixing this issue:

- Fix 21484: Infinite loop in core.memory : GC.{get,set,clr}Attr(const 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.

https://github.com/dlang/druntime/pull/3314
Comment 2 Dlang Bot 2020-12-17 08:07:46 UTC
dlang/druntime pull request #3314 "Fix 21484: Infinite loop in core.memory : GC.{get,set,clr}Attr(const scope void*...)" was merged into stable:

- afec6133be695f2138b86e9b87dcc72a83298379 by Geod24:
  Fix 21484: Infinite loop in core.memory : GC.{get,set,clr}Attr(const 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.

https://github.com/dlang/druntime/pull/3314
Comment 3 Dlang Bot 2020-12-21 01:01:41 UTC
dlang/druntime pull request #3315 "merge stable" was merged into master:

- 027fca5c3d57866f06f838fa755c68835c0994b4 by Geod24:
  Fix 21484: Infinite loop in core.memory : GC.{get,set,clr}Attr(const 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.

https://github.com/dlang/druntime/pull/3315