www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10678] New: Win64: wrong code passing small fixed sized array as function argument

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

           Summary: Win64: wrong code passing small fixed sized array as
                    function argument
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Windows
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: r.sagitario gmx.de


--- Comment #0 from Rainer Schuetze <r.sagitario gmx.de> 2013-07-20 02:02:45
PDT ---
extracted from std.format unittests:

////////////////////////////////////
enum size = 5;

char[size] ret()
{
    char[size] hello = "hello world"[0..size];
    return hello;
}

void test(char[size] txt)
{
    assert(txt == "hello world"[0..size]); // fails
}

void main() 
{
    auto r = ret();
    assert(r == "hello world"[0..size]); // passes

    test(r);
}
/////////////////////////////////////

compile with "dmd -m64 test.d" to trigger the assertion. This happens for array
sizes 5, 6 and 7.

This might be related to issue 9586.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 20 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10678


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com


--- Comment #1 from Walter Bright <bugzilla digitalmars.com> 2013-07-27
13:39:08 PDT ---
Smaller test case:

int test(char[5] txt)
{
    return txt[0] + txt[1] + txt[4];
}

void main()
{
    char[5] hello = void;
    hello[0] = 8;
    hello[1] = 9;
    hello[4] = 10;
    int i = test(hello);
    assert(i == 27);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 27 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10678


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|D2                          |D1 & D2
           Severity|normal                      |critical


--- Comment #2 from Walter Bright <bugzilla digitalmars.com> 2013-07-27
13:41:57 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2391

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 27 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10678



--- Comment #3 from github-bugzilla puremagic.com 2013-07-27 22:28:26 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/92251d67a0a59d4c22d6cb8c7e7557f8d0109bf3
fix Issue 10678 - Win64: wrong code passing small fixed sized array as function
argument

https://github.com/D-Programming-Language/dmd/commit/e0eefafa57a5f765f44268507213991ebaacc9db
Merge pull request #2391 from WalterBright/fix10678

fix Issue 10678 - Win64: wrong code passing small fixed sized array as f...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 27 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10678



--- Comment #4 from github-bugzilla puremagic.com 2013-07-27 22:58:46 PDT ---
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/31b45dbc23f75465b87f25168f4a3ae2bfdc31b2
Merge pull request #2391 from WalterBright/fix10678

fix Issue 10678 - Win64: wrong code passing small fixed sized array as f...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 27 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10678


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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