[Issue 14379] New: bsf(0) < 0 in loop randomly evaluates to non-zero

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Mar 30 17:01:55 PDT 2015


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

          Issue ID: 14379
           Summary: bsf(0) < 0 in loop randomly evaluates to non-zero
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: wrong-code
          Severity: major
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: thecybershadow at gmail.com
                CC: briancschott at gmail.com

////////// test.d /////////
import core.bitop : bsf;

void main()
{
    foreach (_; 0 .. 1)
    {
        int j = bsf(0) < 0;
        assert(j == 0);
    }
}
///////////////////////////

On Ubuntu Linux 14.10, when compiled with DMD 2.067.0 (`dmd -m64 test.d`), the
assert in the above program will fail 50% of the time the program is ran.

Reduced from Issue 14323.

--


More information about the Digitalmars-d-bugs mailing list