[Issue 19968] @safe code can create invalid bools resulting in memory corruption

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jan 6 03:05:28 UTC 2020


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

elronnd at elronnd.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |elronnd at elronnd.net

--- Comment #13 from elronnd at elronnd.net ---
I believe that void initialization of bools should result in their being
zero-initialized.  There is a deeper assumption that bools should be either 0
or 1; that shouldn't be broken by void initialization.  Therefor it should be
ensured that, whatever their value, it's either 0 or 1, and since it's as cheap
to and them with 1 (to get a random result) as to and them with 0 (which is
what mov target, 0 does anyway), zero-initialize them.

--


More information about the Digitalmars-d-bugs mailing list