Thread overview
[Issue 21357] [REG2.093] postblit aliases old and new struct pointers
Nov 03, 2020
Iain Buclaw
Nov 03, 2020
Boris Carvajal
Nov 03, 2020
Iain Buclaw
Nov 03, 2020
Dlang Bot
Nov 11, 2020
Dlang Bot
November 03, 2020
https://issues.dlang.org/show_bug.cgi?id=21357

johanengelen@weka.io changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |industry, wrong-code

--
November 03, 2020
https://issues.dlang.org/show_bug.cgi?id=21357

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw@gdcproject.org

--- Comment #1 from Iain Buclaw <ibuclaw@gdcproject.org> ---
(In reply to johanengelen from comment #0)
> The problem is the following:
> 1. BatchState is a large struct, which means that `BatchState.copy()` is
> passed a pointer to a caller-allocated struct to store its return value
> (instead of returning a value through a register).

I wouldn't count that as a problem, returning large structs is always done using a call slot optimization. It would be more likely whether the callee copies into it or uses the return address directly.  The latter elides a copy, but I don't initially see any reason BatchState should elide a copy (it is POD afterall).

Is there an identified regressing commit yet? Or should I trigger a bisect.

--
November 03, 2020
https://issues.dlang.org/show_bug.cgi?id=21357

Boris Carvajal <boris2.9@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |boris2.9@gmail.com

--- Comment #2 from Boris Carvajal <boris2.9@gmail.com> ---
Caused by:

commit 68275da1a9785ad0bf15782da6502948171271bd
Author: Martin Kinkelin <noone@nowhere.com>
Date:   Wed May 27 00:58:09 2020 +0200

    Fix Issue 11292 - Cannot re-initialize a const field in postblit

--
November 03, 2020
https://issues.dlang.org/show_bug.cgi?id=21357

--- Comment #3 from Iain Buclaw <ibuclaw@gdcproject.org> ---
(In reply to Boris Carvajal from comment #2)
> Caused by:
> 
> commit 68275da1a9785ad0bf15782da6502948171271bd
> Author: Martin Kinkelin <noone@nowhere.com>
> Date:   Wed May 27 00:58:09 2020 +0200
> 
>     Fix Issue 11292 - Cannot re-initialize a const field in postblit

Confirmed.  The change alters the AssignExp `this.low = this.low.copy()` into a ConstructExp.  This is wrong, postblits don't initialize new memory.

--
November 03, 2020
https://issues.dlang.org/show_bug.cgi?id=21357

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

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

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
@ibuclaw updated dlang/dmd pull request #11921 "Revert "Fix Issue 11292 - Cannot re-initialize a const field in postblit"" fixing this issue:

- fix Issue 21357 - [REG2.093] postblit aliases old and new struct pointers

https://github.com/dlang/dmd/pull/11921

--
November 03, 2020
https://issues.dlang.org/show_bug.cgi?id=21357

--- Comment #5 from johanengelen@weka.io ---
(In reply to Iain Buclaw from comment #1)
> (In reply to johanengelen from comment #0)
> > The problem is the following:
> > 1. BatchState is a large struct, which means that `BatchState.copy()` is
> > passed a pointer to a caller-allocated struct to store its return value
> > (instead of returning a value through a register).
> 
> I wouldn't count that as a problem,

Neither do I.
The problem is 2 indeed.

-Johan

--
November 11, 2020
https://issues.dlang.org/show_bug.cgi?id=21357

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

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

--- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #11921 "Revert "Fix Issue 11292 - Cannot re-initialize a const field in postblit"" was merged into master:

- 14b87dbb0f9dfef258bf13041fcacd9dc2d7ac30 by Iain Buclaw:
  fix Issue 21357 - [REG2.093] postblit aliases old and new struct pointers

https://github.com/dlang/dmd/pull/11921

--