std.string.sformat broken in DMD 2.030 ?

dickl dick221z at yahoo.com
Mon May 18 16:13:27 PDT 2009


I filed a bugzilla report on this one back in November with 2.022 (bug # 
2479) Its still is open.

Sivo Schilling wrote:
> Hi all,
> 
> consider the following simple code snippet
> 
> ---
> // check sformat with DMD 2.030/1.045
> 
> import std.stdio;
> import std.string;
> 
> void test_sformat(int value)
> {
>     char[128] buf_;
>     char[] buf;
> 
>     buf = sformat(buf_, "Test sformat with value %d", value);
>     writefln("%s", buf);
> }
> 
> void main()
> {
>     for (int i = 130465; i < 130480; i++) test_sformat(i);
> }
> ---
> 
> With dmd 1.045 compile and run is as expected. The output is:
> ---
> C:\user\sisch\devel\dsource\tests\bin>check_sformat_v1
> Test sformat with value 130465
> Test sformat with value 130466
> Test sformat with value 130467
> Test sformat with value 130468
> Test sformat with value 130469
> Test sformat with value 130470
> Test sformat with value 130471
> Test sformat with value 130472
> Test sformat with value 130473
> Test sformat with value 130474
> Test sformat with value 130475
> Test sformat with value 130476
> Test sformat with value 130477
> Test sformat with value 130478
> Test sformat with value 130479
> 
> With dmd 2.030 building an executable is successfull too, but 
> running the program yields:
> C:\user\sisch\devel\dsource\tests\bin>check_sformat_v2
> object.Error: Access Violation
> 
> Is this a bug ? Could someone explain this unexpected behaviour ?
> 
> OS: Windows XP, SP3
> DMD: see above
> 
> Thanks,
> Sivo.



More information about the Digitalmars-d mailing list