[Issue 19580] New: [non-DMD] std.random seed bootstrap: don't count on reading an uninitialized variable being treated as an ordinary read

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jan 14 06:00:41 UTC 2019


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 at puremagic.com
          Reporter: n8sh.secondary at 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.

--


More information about the Digitalmars-d-bugs mailing list