[Issue 17448] Move semantics cause memory corruption and cryptic bugs
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Mar 11 08:45:47 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=17448
--- Comment #32 from Walter Bright <bugzilla at digitalmars.com> ---
I filed two bug reports based on Tomer's work:
https://issues.dlang.org/show_bug.cgi?id=18575
https://issues.dlang.org/show_bug.cgi?id=18576
which have PRs:
https://github.com/dlang/dmd/pull/7989
https://github.com/dlang/dmd/pull/7990
The second example in comment 1 is a bug in the example, as:
auto f() {auto x = g();}
should be:
auto f() { return g();}
This addresses all the issues in examples provided. I.e. the escapes are
properly detected with -dip1000, and the structs don't move due to RVO (Return
Value Optimization) where the results are written into the caller's stack
frame.
If you discover more problems with escape detection and moved stack objects,
please let me know with examples. Thanks!
--
More information about the Digitalmars-d-bugs
mailing list