www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15207] New: Wrong codegen with -inline

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

          Issue ID: 15207
           Summary: Wrong codegen with -inline
           Product: D
           Version: D2
          Hardware: x86
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: aliloko gmail.com

Compiler: v2.069.0-b2, x86 arch


To reproduce: compile with dmd -inline main.d

This bug disappear when -inline is removed.

---------------------------------------------->8------------

struct vec3f
{
    float x, y, z;

    this(float x_, float y_, float z_)
    {
        x = x_;
        y = y_;
        z = z_;
    }

    vec3f clone()
    {
        vec3f res = this;
        return res;
    }
}

class AnnoyingRegression
{
    vec3f a;

    this() 
    {
        a = vec3f(1, 2, 3).clone;

        // Writes nan nan nan if -inline switch
        // Writes 1 2 3 if no -inline switch
        import std.stdio;
        writefln("%s %s %s", a.x, a.y, a.z);        
    }
}
void main(string[]args)
{
    new AnnoyingRegression();   
}

---------------------------------------------->8------------

--
Oct 15 2015