one of the weirdest bugs ever - request for testing

captaindet via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jun 12 12:20:13 PDT 2014


hi,

i just run into a (wrong code gen?) bug that manifests itself only under certain conditions.

before i file it, i'd like to know if it is still around in the latest DMD version and/or if other platforms and 64bit code is affected as well.

bug description:
std.algorithm.countUntil fails to find the needle

my system:
DMD 2.0642 compiling into 32bit code on Win7 64bit

required conditions:
compile with -release -inline -noboundscheck
(an additional -O will also cause the bug)
AND the module imports std.file

/det

----

import std.stdio;
import std.algorithm;
import std.file;    // not needed, but if imported, causing trouble, see below

void main()
{
     auto names = ["one","FOO","two","three"];

// wrong code gen(*) with -release -O -inline -noboundscheck or
// with -release -inline -noboundscheck but only if std.file is imported:
  
     auto x = countUntil( names, "FOO" );
     write(x);
     if( 0 <= x ) writeln(" found a FOO");     // (*) not found!
}


More information about the Digitalmars-d-learn mailing list