Thread overview
[Issue 8526] New: DMD 2.060 regression: anonymous delegate call in foreach loop
Aug 09, 2012
Vladimir Panteleev
Sep 05, 2012
Damian Ziemba
Nov 09, 2012
Kenji Hara
Nov 09, 2012
Kenji Hara
Nov 09, 2012
Kenji Hara
Nov 09, 2012
Kenji Hara
Nov 09, 2012
Kenji Hara
August 09, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8526

           Summary: DMD 2.060 regression: anonymous delegate call in
                    foreach loop
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: wrong-code
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: thecybershadow@gmail.com


--- Comment #0 from Vladimir Panteleev <thecybershadow@gmail.com> 2012-08-09 00:34:53 PDT ---
void call(void delegate() callback)
{
    callback();
}

void f(int j, int i)
{
}

void main()
{
    foreach (int i, j; [0])
        call({
            f(j, i);
        });
}

Works on 2.059, segfaults on 2.060. Tested on Win32 and Linux/64.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 05, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8526


Damian Ziemba <nazriel6969@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nazriel6969@gmail.com


--- Comment #1 from Damian Ziemba <nazriel6969@gmail.com> 2012-09-05 01:52:43 PDT ---
Works with DMD 1.075
Looks like it is D2 only.

DMD2.060 fails both with m32/m64, on Linux and FreeBSD


Current DMD2 trunk still has this bug.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 09, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8526


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |russel@winder.org.uk


--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2012-11-08 19:43:00 PST ---
*** Issue 8775 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 09, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8526



--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2012-11-08 19:45:42 PST ---
From bug 8775, foreach range statement has same bug.

void call(void delegate() dg) { dg(); }
void main()
{
    foreach (i, j; [0])
    {
        call({
            assert(i == 0); // fails, i is corrupted
        });
    }

    foreach (n; 0..1)
    {
        call({
            assert(n == 0); // fails, n is corrupted
        });
    }
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 09, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8526


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fawzi@gmx.ch


--- Comment #4 from Kenji Hara <k.hara.pg@gmail.com> 2012-11-08 21:15:15 PST ---
*** Issue 8974 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 09, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8526


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #5 from Kenji Hara <k.hara.pg@gmail.com> 2012-11-09 02:17:24 PST ---
https://github.com/D-Programming-Language/dmd/pull/1272

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 09, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8526



--- Comment #6 from github-bugzilla@puremagic.com 2012-11-09 04:15:57 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/251a8bb0ede5e45bf5f41b60554a2962261516ff fix Issue 8526 - DMD 2.060 regression: anonymous delegate call in foreach loop

This regression has occured from the commit: https://github.com/D-Programming-Language/dmd/commit/38a0a5141a3455395e8b9571a57bf85ed698c6b3

But the root cause is a bug in glue layer. When an internal ref variable is marked as closure var, the glue layer had generated incorrect code for that.

https://github.com/D-Programming-Language/dmd/commit/8fc3e4b59bf5786accee257d301ca8de8cf8a277 Merge pull request #1272 from 9rnsr/fix8526

Issue 8526 & 6141 - DMD 2.060 regression: anonymous delegate call in foreach loop

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 09, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8526


Kenji Hara <k.hara.pg@gmail.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: -------