Bug 14606 – [REG2.067.0] Bad code with -inline and structs

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2015-05-19T00:02:00Z
Last change time
2015-06-17T21:05:28Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
dlang-bugzilla

Comments

Comment #0 by dlang-bugzilla — 2015-05-19T00:02:20Z
Crashes on Windows with -m64 -inline: ////////// test.d ///////// struct S { this(long stdTime) { _stdTime = stdTime; } long _stdTime; } S getS() { S sysTime = S(0); return sysTime; } struct T { this(string) { uint[3] arr; s = getS(); } S s; } void main() { T(null); } /////////////////////////// Introduced in https://github.com/D-Programming-Language/dmd/pull/3979
Comment #1 by k.hara.pg — 2015-05-26T11:56:07Z
> Introduced in https://github.com/D-Programming-Language/dmd/pull/3979 The broken executable has been generated since 2.065, which and it was introduced in: https://github.com/D-Programming-Language/dmd/pull/2592
Comment #2 by dlang-bugzilla — 2015-05-26T12:10:36Z
Err, confirmed, thanks. I got the original reduction result on Linux but now I can't reproduce it.
Comment #3 by k.hara.pg — 2015-05-26T13:37:31Z
Comment #4 by github-bugzilla — 2015-05-31T00:04:04Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/10fc5c4227911d4abf4727a283e56afa0aedd783 fix Issue 14606 - Bad code with -inline and structs The wrong-code had caused by the combination of special memset expression `(struct = 0)` and inlining field variable initialization with NRVO. The extended inlining had introduced ConstructExp(ref_var, 0), but it was wrongly handled as reference initialization in AssignExp::toElem(). To fix that, use `BlitExp` for the memset expression always, and avoid confusion with the ref initialization. https://github.com/D-Programming-Language/dmd/commit/58047b08977cc82f09238e8ac6300dd5158a7acb Merge pull request #4683 from 9rnsr/fix14606 [REG2.067.0] Issue 14606 - Bad code with -inline and structs
Comment #5 by github-bugzilla — 2015-06-17T21:05:28Z