[Issue 3500] New: Program behaves differently with -inline

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 12 10:20:49 PST 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3500

           Summary: Program behaves differently with -inline
           Product: D
           Version: 2.035
          Platform: Other
        OS/Version: All
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: nfxjfg at gmail.com


--- Comment #0 from nfxjfg at gmail.com 2009-11-12 10:20:47 PST ---
The following program behaves differently whether you pass -inline to dmd or
not.
The correct output is "A::x()", but with -inline, it outputs "B::x()".
Conclusion: the dmd inliner must be buggy.
I confirmed this with:
- dmd 1.051/Tango
- dmd 2.035/Phobos

Command line, failing binary: dmd bug.d -inline
Correct binary: dmd bug.d

Test using Tango:

import tango.util.log.Trace;

class A {
    void x() {
        Trace.formatln("A::x()");
    }
}

class B : A {
    override void x() {
        Trace.formatln("B::x()");
    }

    private void do_x() {
        super.x();
    }
}

void main() {
    B b = new B();
    b.do_x();
}

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


More information about the Digitalmars-d-bugs mailing list