www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19580] New: [non-DMD] std.random seed bootstrap: don't count

https://issues.dlang.org/show_bug.cgi?id=19580

          Issue ID: 19580
           Summary: [non-DMD] std.random seed bootstrap: don't count on
                    reading an uninitialized variable being treated as an
                    ordinary read
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: n8sh.secondary hotmail.com

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.
--
Jan 13 2019