www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21822] New: Optimizer flowlv() does not account for OPmemcmp

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

          Issue ID: 21822
           Summary: Optimizer flowlv() does not account for OPmemcmp and
                    OPstrcmp
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: bugzilla digitalmars.com

The following:

 char[4] sun();

 bool moon() {
    auto a = sun();
    auto b = sun();
    return a == b;  // generates OPmemcmp
 }

may be incorrectly compiled when optimized because the flowlv() function in the
optimizer does not account for the OPmemcmp or OPstrcmp intermediate code
operators.

This problem was exposed by https://github.com/dlang/dmd/pull/12409

--
Apr 12 2021