www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13977] New: Front-end optimizer bug in AndAndExp

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

          Issue ID: 13977
           Summary: Front-end optimizer bug in AndAndExp
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: wrong-code
          Severity: major
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: k.hara.pg gmail.com

Compiling with version=B and version=D should have consistent runtime behavior,
but doesn't.

bool cond(bool b) { return b; }

void main()
{
    version(A) cond(true) && assert(0);    // asserts in runtime, ok
    version(B) cond(false) && assert(0);   // no assert, ok

    version(C) true && assert(0);   // assert in runtime, ok
    version(D) false && assert(0);  // asserts in runtime, why?
}

--
Jan 13 2015