[Issue 24855] New: VRP fails to prevent overflow after division
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Nov 12 11:17:39 UTC 2024
https://issues.dlang.org/show_bug.cgi?id=24855
Issue ID: 24855
Summary: VRP fails to prevent overflow after division
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: accepts-invalid
Severity: minor
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: dkorpel at live.nl
Found by IchorDev:
https://forum.dlang.org/reply/emmuvvrfaeplqkjufkch@forum.dlang.org
```
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.
--
More information about the Digitalmars-d-bugs
mailing list