www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12779] New: [REG2.066a] -inline makes wrong code under some


          Issue ID: 12779
           Summary: [REG2.066a] -inline makes wrong code under some
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Keywords: wrong-code
          Severity: regression
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: jiki red.email.ne.jp

This issue is triggered by:

I have struggled to reduce it though it is rather complicated.

*lib.d ---------
module lib;

void test( string data) {
    auto ret = new Foo();
    ret.data = data;
    assert(ret.data.length < 1_000_000); // OK!
    ret.check(); // NG

class Foo {
    // Removing this or changing order of these members
    // affects the runtime behavior ...
    version (defined) {
        int[int] unusedAA;

    string data;

    void check() {
        assert(data.length < 1_000_000); // NG!

*main.d ---------
import lib;

void main()
    string data = "text";
    test( data);

COMMANDS(compile and run):
dmd.exe -lib -version=defined lib.d
dmd.exe -g  -inline inlinebug.d lib.lib

core.exception.AssertError lib.d(20): Assertion failure
0x00402487 in _d_assert
0x004020DB in void lib.Foo.check()
0x0040206C in _Dmain

May 21 2014