www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8870] New: Incorrect values passing struct by value

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8870

           Summary: Incorrect values passing struct by value
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: turkeyman gmail.com



http://dpaste.dzfl.pl/82f04399

t2 is [5, 6, 5, 6] when compiled with DMD-x64. should be [5, 6, 7, 8].
extern (C) fixes the problem.

----------------------------------------------------

import std.stdio;

struct Test
{
    float x = 0;
    float y = 0;
    float z = 0;
    float w = 0;
}

void main()
{
    Test r1 = Test(1,2,3,4);
    Test r2 = Test(5,6,7,8);

    test(r1, r2, false, 1);
}

void test(Test t1, Test t2, bool someBool, float finalFloat)
{
    // at this point, t2 == { 5, 6, 5, 6 }
    writeln(t2);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 22 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8870




Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/ac1d035fb96f64f8e00a7561de41eb76a0f36f30
fix Issue 8870 - Incorrect values passing struct by value

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 25 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8870




Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/96ceb08723a061b5898c26748be8267b58e4fe05
fix Issue 8870 - Incorrect values passing struct by value

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 25 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8870


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED
           Severity|normal                      |critical


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