www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Bug 95] New: foreach() over empty AA yields Access Violation

reply d-bugmail puremagic.com writes:
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
}


-- 
Apr 08 2006
next sibling parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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 -----BEGIN PGP SIGNATURE----- iD8DBQFEOLO93w+/yD4P9tIRAne3AKCXwPswPGm1bsXzgT7M1nyWFEerBACfQew2 mr8hcIW+GAmLszLrEW5kwDM= =p/7L -----END PGP SIGNATURE-----
Apr 08 2006
prev sibling next sibling parent reply d-bugmail puremagic.com writes:
http://d.puremagic.com/bugzilla/show_bug.cgi?id=95


smjg iname.com changed:

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





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.


-- 
Apr 09 2006
next sibling parent Walter Bright <newshound digitalmars.com> writes:
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.
Apr 09 2006
prev sibling parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

d-bugmail puremagic.com schrieb am 2006-04-09:
 http://d.puremagic.com/bugzilla/show_bug.cgi?id=95

 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 -----BEGIN PGP SIGNATURE----- iD8DBQFEOWOQ3w+/yD4P9tIRAo6BAJ9QRbbynIICx23H8UY++fHYCrAhbwCdF7Px AegIgXpNCy/EssV8sNYqRVc= =43pG -----END PGP SIGNATURE-----
Apr 09 2006
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/bugzilla/show_bug.cgi?id=95


bugzilla digitalmars.com changed:

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





Fixed 0.153


-- 
Apr 10 2006