Bug 24855 – VRP fails to prevent overflow after division

Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2024-11-12T11:17:39Z
Last change time
2024-11-13T00:49:13Z
Keywords
accepts-invalid, pull
Assigned to
No Owner
Creator
Dennis

Comments

Comment #0 by dkorpel — 2024-11-12T11:17:39Z
Found by IchorDev: https://forum.dlang.org/reply/[email protected] ``` void f() { short x = short.max; short div = 1; short y = x / div + 1; } ``` Expected behavior: Error that expression `x / div + 1` can't implicitly convert to short. Actual behavior: compiles without error.
Comment #1 by dlang-bot — 2024-11-12T22:46:18Z
@dkorpel updated dlang/dmd pull request #17060 "Fix 24855 - VRP fails to prevent overflow after division" fixing this issue: - Fix bugzilla 24855 - VRP fails to prevent overflow after division https://github.com/dlang/dmd/pull/17060
Comment #2 by dlang-bot — 2024-11-13T00:49:13Z
dlang/dmd pull request #17060 "Fix 24855 - VRP fails to prevent overflow after division" was merged into master: - 5609e3615f6dabcea6b73a5928579d371ce44888 by Dennis Korpel: Fix bugzilla 24855 - VRP fails to prevent overflow after division https://github.com/dlang/dmd/pull/17060