[Issue 7953] DMD Error: variable r used before set when compiling with -O

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Apr 24 22:51:48 PDT 2016


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

Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla at digitalmars.com
         Resolution|---                         |INVALID

--- Comment #6 from Walter Bright <bugzilla at digitalmars.com> ---
    float4 r;
    ...
    res.ptr[4] = r.ptr[4]; // Error: variable r used before set

The error here is that there are only 4 entries in float4, and you're indexing
the 5th one. If the function is marked @safe, it won't compile.

Not a compiler bug.

--


More information about the Digitalmars-d-bugs mailing list