Thread overview
[Issue 22124] Corrupted closure when compiling with -preview=dip1000
Jul 14, 2021
Vladimir Panteleev
Jul 14, 2021
Dennis
Jul 15, 2021
Dlang Bot
Aug 19, 2021
Dlang Bot
Aug 23, 2021
Dlang Bot
July 14, 2021
https://issues.dlang.org/show_bug.cgi?id=22124

--- Comment #1 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> ---
(In reply to Vladimir Panteleev from comment #0)
> The following program will segfault

Assert, not segfault.

--
July 14, 2021
https://issues.dlang.org/show_bug.cgi?id=22124

Dennis <dkorpel@live.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dkorpel@live.nl

--- Comment #2 from Dennis <dkorpel@live.nl> ---
Probably a combination of issue 20150 and/or issue 21912.

See also my thread example in: https://forum.dlang.org/thread/jnkdcngzytgtobihzggj@forum.dlang.org

A closure should be created on the heap for the stackframe of fun4, but dmd doesn't do that because Thread's constructor is `pure` so the delegate becomes `scope`. We can make the parameter in the constructor explicitly `return scope`, but considering issue 21912, that might not be enough.

--
July 15, 2021
https://issues.dlang.org/show_bug.cgi?id=22124

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #3 from Dlang Bot <dlang-bot@dlang.rocks> ---
@dkorpel created dlang/druntime pull request #3520 "Fix issue 22124 - Corrupted closure with -dip1000 " fixing this issue:

- Fix issue 22124 - Corrupted closure with -dip1000

- Add test case for issue 22124

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

--
August 19, 2021
https://issues.dlang.org/show_bug.cgi?id=22124

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
@dkorpel created dlang/druntime pull request #3550 "Add test case for issue 22124" mentioning this issue:

- Add test case for issue 22124

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

--
August 23, 2021
https://issues.dlang.org/show_bug.cgi?id=22124

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/druntime pull request #3550 "Add test case for issue 22124" was merged into master:

- b4006f2b7a6dd8357f8f87bb3cad606078dfa9d7 by dkorpel:
  Fix issue 22124 - Corrupted closure when compiling with -preview=dip1000

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

--