www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19758] New: (0x01 & 0xFF) == 0 by dmd 2.085.0(-m64) on Windows

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

          Issue ID: 19758
           Summary: (0x01 & 0xFF) == 0 by dmd 2.085.0(-m64) on Windows
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: kntroh gmail.com

PS[test]$ type oneiszero.d

void main() {
    byte[1] a = [1];
    int b = 0;

    // If delete this 4 lines, the result is correct.
    if (a[b] == 0) {
        a[b] = 0;
        if (1 << b) { }
    }

    // If enable this assertion, the result is correct.
//  assert ((a[b] & 0xFF) == 1);
    if ((a[b] & 0xFF) == 0) {
        // Oddly, this block is executed. dmd 2.085.0(-m64) with Windows 8.1 or
 10.
        assert((a[b] & 0xFF) == 0);
    }
}
PS[test]$ dmd.exe -m64 -run oneiszero.d

core.exception.AssertError oneiszero.d(16): Assertion failure
----------------
0x00007FF6803611DB
0x00007FF68036110E
0x00007FF6803619F2
0x00007FF68036187F
0x00007FF68036195B
0x00007FF68036187F
0x00007FF6803617B1
0x00007FF680361134
0x00007FF68038B618
0x00007FFC809713D2 in BaseThreadInitThunk
0x00007FFC80CC54F4 in RtlUserThreadStart
PS[test]$

--
Mar 21 2019