Thread overview
[Bug 95] New: foreach() over empty AA yields Access Violation
Apr 08, 2006
d-bugmail
Apr 09, 2006
Thomas Kuehne
[Bug 95] foreach() over uninitalized AA yields Access Violation
Apr 09, 2006
d-bugmail
Apr 09, 2006
Walter Bright
Apr 09, 2006
Thomas Kuehne
Apr 11, 2006
d-bugmail
April 08, 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=95

           Summary: foreach() over empty AA yields Access Violation
           Product: D
           Version: 0.151
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: ericanderton@yahoo.com


Under Windows, using foreach to iterate over an uninitalized AA generates an Access Violation.

//////////////////////////
import std.stdio;

void main(){
        uint[char[]] foobar;
        foreach(value; foobar){} // fails on foreach
}


-- 

April 09, 2006
d-bugmail@puremagic.com schrieb am 2006-04-08:
> http://d.puremagic.com/bugzilla/show_bug.cgi?id=95
> Under Windows, using foreach to iterate over an uninitalized AA generates an
> Access Violation.
>
> //////////////////////////
> import std.stdio;
>
> void main(){
>         uint[char[]] foobar;
>         foreach(value; foobar){} // fails on foreach
> }

Added to DStress as http://dstress.kuehne.cn/run/f/foreach_35_A.d http://dstress.kuehne.cn/run/f/foreach_35_B.d http://dstress.kuehne.cn/run/f/foreach_35_C.d

Thomas


April 09, 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=95


smjg@iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg@iname.com
           Keywords|                            |wrong-code




------- Comment #2 from smjg@iname.com  2006-04-09 06:52 -------
I experimented with this a bit after it broke a bit of SDWF.  It happens only if the AA is actually uninitialised - if you've added something to the AA and then deleted it then it behaves correctly.


-- 

April 09, 2006
It's a bug I introduced when fixing other problems in the AA. It's fixed now, and will go out in the next update.
April 09, 2006
d-bugmail@puremagic.com schrieb am 2006-04-09:
> http://d.puremagic.com/bugzilla/show_bug.cgi?id=95
> ------- Comment #2 from smjg@iname.com  2006-04-09 06:52 -------
> I experimented with this a bit after it broke a bit of SDWF.  It happens only if the AA is actually uninitialised - if you've added something to the AA and then deleted it then it behaves correctly.

Added to DStress as http://dstress.kuehne.cn/run/f/foreach_35_D.d

Thomas


April 11, 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=95


bugzilla@digitalmars.com changed:

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




------- Comment #4 from bugzilla@digitalmars.com  2006-04-11 01:34 -------
Fixed 0.153


--