D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 19758 - (0x01 & 0xFF) == 0 by dmd 2.085.0(-m64) on Windows
Summary: (0x01 & 0xFF) == 0 by dmd 2.085.0(-m64) on Windows
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Windows
: P1 regression
Assignee: No Owner
URL:
Keywords: pull, wrong-code
Depends on:
Blocks:
 
Reported: 2019-03-22 05:56 UTC by kntroh
Modified: 2019-06-19 21:17 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description kntroh 2019-03-22 05:56:32 UTC
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]$
Comment 1 Rainer Schuetze 2019-06-16 18:04:28 UTC
Introduced by https://github.com/dlang/dmd/pull/9015 but the root cause is probably elsewhere.
Comment 2 Dlang Bot 2019-06-16 19:45:45 UTC
@rainers created dlang/dmd pull request #10047 "fix Issue 19758 - (0x01 & 0xFF) == 0 by dmd 2.085.0(-m64) on Window" fixing this issue:

- fix Issue 19758 - (0x01 & 0xFF) == 0 by dmd 2.085.0(-m64) on Window
  
  operation "test SIL,SIL" needs REX prefix

https://github.com/dlang/dmd/pull/10047
Comment 3 Dlang Bot 2019-06-19 21:17:50 UTC
dlang/dmd pull request #10047 "fix Issue 19758 - (0x01 & 0xFF) == 0 by dmd 2.085.0(-m64) on Window" was merged into stable:

- 01b7ee6f0906b0fbc3a78b024b0a749d1b56d249 by Rainer Schuetze:
  fix Issue 19758 - (0x01 & 0xFF) == 0 by dmd 2.085.0(-m64) on Window
  
  operation "test SIL,SIL" needs REX prefix

https://github.com/dlang/dmd/pull/10047