← Back to index
|
Original Bugzilla link
Bug 19580 – [non-DMD] std.random seed bootstrap: don't count on reading an uninitialized variable being treated as an ordinary read
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-01-14T06:00:41Z
Last change time
2019-02-06T22:43:51Z
Assigned to
No Owner
Creator
Nathan S.
Comments
Comment #0
by n8sh.secondary — 2019-01-14T06:00:41Z
Calculations that transform an uninitialized variable may be omitted by LDC when optimizations are enabled. This is allowed by the standard so even though this does not affect DMD it should be avoided. See:
https://github.com/ldc-developers/ldc/pull/2946#issuecomment-453828010
And:
https://dlang.org/spec/declaration.html#void_init
>If a void initialized variable's value is used before it is set, the behavior is undefined.
Comment #1
by n8sh.secondary — 2019-01-14T06:13:22Z
Pull request:
https://github.com/dlang/phobos/pull/6833
Comment #2
by hsteoh — 2019-02-06T22:43:51Z
The PR appears to have been merged, so closing this. Please reopen if there still remains further associated issues to be fixed.