www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - std.string.sformat broken in DMD 2.030 ?

reply Sivo Schilling <sivo.schilling web.de> writes:
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.
May 17 2009
parent dickl <dick221z yahoo.com> writes:

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.
May 18 2009