bug of scope (linux only) verified, Critical

redsea redsea at 163.com
Tue Dec 16 22:56:32 PST 2008


error: 
scope(success) is not execuated, 
RAII variable destructor is not called, this bug is critical.

I wrote a phobos version test program, and found windows version of dmd is correct, but not linux version.

I test dmd 1.038. 1.037, 1.023, all is wrong.

the test program is as following:

import std.stdio;
alias writefln ot;

scope class Indent
{
    this()
    {
        ot("<<<");
    }
    ~this()
    {
        ot(">>>");
    }
}

void doScan(int a)
{
    ot("doScan {{{");

    scope(exit)
        {}
    scope(failure)
        ot("doScan failure }}}");
    scope(success)
        ot("doScan ok }}}");

    scope auto ident__doScan__ident = new Indent();
    if (a == 0 )
        return;
}


void main()
{
    for (int i=0; i<8;i++)
        doScan(0);
}


comment the following lines,  result would be ok:

    if (a == 0 )
        return;


the error output: (copy from linux dmd 1.038, running on debian lenny)
[tmp]root ./t
doScan {{{
<<<
doScan {{{
<<<
doScan {{{
<<<
doScan {{{
<<<
doScan {{{
<<<
doScan {{{
<<<
doScan {{{
<<<
doScan {{{
<<<

the correct output (copy from windows dmd 1.038)
C:\TEMP>t.exe
doScan {{{
<<<
>>>
doScan ok }}}
doScan {{{
<<<
>>>
doScan ok }}}
doScan {{{
<<<
>>>
doScan ok }}}
doScan {{{
<<<
>>>
doScan ok }}}
doScan {{{
<<<
>>>
doScan ok }}}
doScan {{{
<<<
>>>
doScan ok }}}
doScan {{{
<<<
>>>
doScan ok }}}
doScan {{{
<<<
>>>
doScan ok }}}







More information about the Digitalmars-d mailing list