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



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




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



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)



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)                 |



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




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



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




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


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




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


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




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