digitalmars.D.bugs - [Issue 13383] New: wrong code with -O with ints, longs and bitwise
- via Digitalmars-d-bugs (31/31) Aug 27 2014 https://issues.dlang.org/show_bug.cgi?id=13383
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 puremagic.com Reporter: gassa 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. --
Aug 27 2014