[Issue 23147] Integer division may cause undefined behavior in @safe code

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Aug 10 10:05:00 UTC 2022


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

RazvanN <razvan.nitu1305 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305 at gmail.com

--- Comment #1 from RazvanN <razvan.nitu1305 at gmail.com> ---
Usually, Walter argues that @safe refers to memory safety. Yes, I know that in
the spec it is stated that @safe code may not lead to undefined behavior,
however, you can void initialize a variable (that is not a pointer) in safe
code, then I don't see why you would not be able to divide by 0. These can lead
to undefined behavior, but not necessarily to memory corruption.

Based on that, this bug report is invalid.

--


More information about the Digitalmars-d-bugs mailing list