[Issue 12095] New: Wrong code with -O -inline and final functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Feb 7 00:23:32 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12095

           Summary: Wrong code with -O -inline and final functions
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: clugdbug at yahoo.com.au


--- Comment #0 from Don <clugdbug at yahoo.com.au> 2014-02-07 00:23:30 PST ---
Applies to both D1 and D2. Requires -O -inline.
The "if (e) " branch is taken, even though e is null.
----
int* func12095()  { return null;  }

class Bug12095
{
    final void get(int a, int b)
    {
        auto e = func12095();
        if (e)
            assert (a, "fail");
        else
            assert (!b);
    }

    void fun(int k) {
        get(k, 0);
    }
}

void main()
{
    auto yy = new Bug12095;
    yy.fun(0);
}

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list