[Issue 21166] error message when unittesting std/array depends on -cov and -O switches

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Feb 27 06:43:05 UTC 2022


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

Walter Bright <bugzilla at digitalmars.com> changed:

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

--- Comment #1 from Walter Bright <bugzilla at digitalmars.com> ---
>        Unqual!U[n] theArray = void;
>        return theArray;

But it *is* used before set! Setting it to `void` means it is not set to
anything, i.e. is unset.

It happens with -O because the optimizer uses data flow analysis to detect
these things. The front end has no ability to do it.

The other things that affect it likely come down to an interaction between the
-cov and the optimizer.

I suggest fixing the code so it doesn't use uninitialized variables.

--


More information about the Digitalmars-d-bugs mailing list