Bug 19758 – (0x01 & 0xFF) == 0 by dmd 2.085.0(-m64) on Windows
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2019-03-22T05:56:32Z
Last change time
2019-06-19T21:17:50Z
Keywords
pull, wrong-code
Assigned to
No Owner
Creator
kntroh
Comments
Comment #0 by kntroh — 2019-03-22T05:56:32Z
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
[email protected](16): Assertion failure
----------------
0x00007FF6803611DB
0x00007FF68036110E
0x00007FF6803619F2
0x00007FF68036187F
0x00007FF68036195B
0x00007FF68036187F
0x00007FF6803617B1
0x00007FF680361134
0x00007FF68038B618
0x00007FFC809713D2 in BaseThreadInitThunk
0x00007FFC80CC54F4 in RtlUserThreadStart
PS[test]$