[Issue 20893] [REG 2.087] 32-bit arithmetic goes wrong

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jun 2 04:50:19 UTC 2020


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

Basile-z <b2.temp at gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 CC|                            |b2.temp at gmx.com
                 OS|Windows                     |All

--- Comment #1 from Basile-z <b2.temp at gmx.com> ---
reduced w/o phobos, test case is a "runnable" TC:

---
#!dmd -O -inline -m32

int f (int n)
{
    foreach (i; 0..n) {}
    return 10;
}

int c (int a, int b)
{
    return (f(a) * 1L * f(b)) % 1000;
}

void main ()
{
    int[] a = [1];
    assert(c(2 - 1, 2) == 100);
}
---

--


More information about the Digitalmars-d-bugs mailing list