[Issue 13383] New: wrong code with -O with ints, longs and bitwise operations
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Aug 27 06:47:47 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13383
Issue ID: 13383
Summary: wrong code with -O with ints, longs and bitwise
operations
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Severity: normal
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: gassa at mail.ru
Consider the following code (minimized example):
-----
void main () {
foreach (k; 32..33) {
if (1L & (1L << k)) {
assert (false);
}
}
}
-----
Obviously, 1L & (1L << k) must be true only when k = 0.
Still, with k = 32, it produces a true value when compiled with "dmd -O".
All is well without "-O".
It is reproducible for me with DMD 2.064.2-2.066.0 on Win32. It works for me
with DMD 2.063.2. So, the issue was probably introduced between 2.063.2 and
2.064.2.
--
More information about the Digitalmars-d-bugs
mailing list