www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9568] New: [64bit] wrong code for ref parameter and scope(success)

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

           Summary: [64bit] wrong code for ref parameter and
                    scope(success)
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: clugdbug yahoo.com.au


--- Comment #0 from Don <clugdbug yahoo.com.au> 2013-02-22 00:59:55 PST ---
64 bit only. Originally found in D1, but also applies to D2.
------

int bug9568(ref string x)
{
    string y = x;
    scope (success)
    {
        assert(x == y);
    }
    return 0;
}

void main()
{
    string e = "xxx";    
    int result = bug9568(e);
    assert( ! result ); // fails
}

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



--- Comment #1 from Don <clugdbug yahoo.com.au> 2013-02-22 01:33:13 PST ---
Slightly clearer test case, which works unaltered on D1 as well. It is
necessary for both x and y to be passed as parameters (this was happening with
x==y in my first test case, which was making a call to the runtime).
------
void use9568(char [] m, char [] p) {}

int bug9568(ref char[] x)
{
    char[] y = x;
    scope (success)
        use9568(x,y);
    return 7;
}

void main()
{
    char[] e = null;
    assert( bug9568(e) == 7 );
}

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


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |regression


--- Comment #2 from Don <clugdbug yahoo.com.au> 2013-02-22 01:42:18 PST ---
And it's a regression (at least on D1, haven't checked old versions of D2).
This code worked in 1.074 and 1.075, fails in 1.076.

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


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[64bit] wrong code for      |[64bit] wrong code for
                   |array ref parameter and     |array ref parameter and
                   |scope(success)              |scope(exit)


--- Comment #3 from Don <clugdbug yahoo.com.au> 2013-02-22 02:55:30 PST ---
Also applies to scope(exit), which is more important because it is more
commonly used.

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


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[64bit] wrong code for      |[64bit] wrong code for
                   |array ref parameter and     |scope(exit)
                   |scope(exit)                 |


--- Comment #4 from Don <clugdbug yahoo.com.au> 2013-02-22 03:40:06 PST ---
Even further reduced. Reference parameter is not necessary. I also replaced the
scope(exit) with a try{}finally{} block, which is what happens in the
front-end.
==================
void use9568(char [] x, char [] y) {}

int bug9568()
{
    try
        return 7;
     finally
        use9568(null,null);
}

void main()
{
    assert( bug9568() == 7 );
}

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



--- Comment #5 from github-bugzilla puremagic.com 2013-02-24 23:48:07 PST ---
Commit pushed to fix9568 at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/adf20ce10fcfec68cf74cad7aa110c3a314d45f7
fix Issue 9568 - [64bit] wrong code for scope(exit)

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


Walter Bright <bugzilla digitalmars.com> changed:

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


--- Comment #6 from Walter Bright <bugzilla digitalmars.com> 2013-02-24
23:50:45 PST ---
https://github.com/D-Programming-Language/dmd/pull/1689

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



--- Comment #7 from github-bugzilla puremagic.com 2013-02-25 01:15:40 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/adf20ce10fcfec68cf74cad7aa110c3a314d45f7
fix Issue 9568 - [64bit] wrong code for scope(exit)

https://github.com/D-Programming-Language/dmd/commit/2352d02ec79eef3a19dd3f743088b382a239f17e
Merge pull request #1689 from WalterBright/fix9568

fix Issue 9568 - [64bit] wrong code for scope(exit)

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


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: -------
Feb 25 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9568



--- Comment #8 from github-bugzilla puremagic.com 2013-02-25 10:29:05 PST ---
Commits pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/f50e8f5dbd91aae4fb3beaa900b966c2938348d1
fix Issue 9568 - [64bit] wrong code for scope(exit)

https://github.com/D-Programming-Language/dmd/commit/1cbce51be1e5a686f53e4c81f686d6b728dbacbf
Merge pull request #1690 from donc/mergeBug9568

D1: fix Issue 9568 - [64bit] wrong code for scope(exit)

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



--- Comment #9 from github-bugzilla puremagic.com 2013-02-25 10:38:44 PST ---
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/3c0bbdaf63bfa1922b94670125a2192dc9fb281f
fix Issue 9568 - [64bit] wrong code for scope(exit)

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