[Issue 15207] New: Wrong codegen with -inline

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Oct 15 08:47:41 PDT 2015


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 at puremagic.com
          Reporter: aliloko at 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------------

--


More information about the Digitalmars-d-bugs mailing list