[Issue 15585] VRP incorrectly assumes that out-of-range dchar values don't exist
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Jan 20 12:29:56 PST 2016
https://issues.dlang.org/show_bug.cgi?id=15585
hsteoh at quickfur.ath.cx changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hsteoh at quickfur.ath.cx
Severity|normal |critical
--- Comment #1 from hsteoh at quickfur.ath.cx ---
Actually, it *does* already cause a very visible, nasty problem:
https://issues.dlang.org/show_bug.cgi?id=15586
Basically, by assuming that dchar can never have invalid values (no matter
where the dchar came from), the compiler has basically turned all code
containing `cast(dchar)` into undefined behaviour, because it will optimize out
all character range checks (under its wrong assumption, none of the checks can
ever fail, since dchar can't possibly have invalid values). This means
string-vetting functions are basically turned to no-ops, and code that's
supposed to throw exceptions or assert errors upon invalid dchar values will
instead continue running wildly forward. This could mean that a function that's
supposed to return something may actually return nothing, and the caller will
get a garbage value instead (from whatever detritus is left in the return
register when it was last modified).
These problems are already showing up, even in non-release mode. I'm raising
the severity of this bug.
--
More information about the Digitalmars-d-bugs
mailing list