www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - one of the weirdest bugs ever - request for testing

reply captaindet <2krnk gmx.net> writes:
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!
}
Jun 12 2014
next sibling parent reply Andrew Edwards <ridimz yahoo.com> writes:
On 6/12/14, 3:20 PM, captaindet wrote:
 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!
 }
I'm running OSX Mavericks with DMD v2.065.0. This behavior cannot be reproduced.
Jun 12 2014
parent Philippe Sigaud via Digitalmars-d-learn writes:
 // 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!
 }
I'm running OSX Mavericks with DMD v2.065.0. This behavior cannot be reproduced.
Linux, 64bits, DMD v2.065.0 Works OK for me ("1 found a FOO"), with or without importing std.file and compiling with -release -inline -noboundscheck
Jun 12 2014
prev sibling parent reply captaindet <2krnk gmx.net> writes:
On 2014-06-12 14:20, captaindet wrote:

 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.
thanks andrew, philippe, i had the suspicion that it is a windows only problem anyway because the only thing that an unused std.file would do is pulling a lot of windows specific stuff (on my system). if now someone could test this with the current DMD on windows, 64 and 32 bit executables... /det
Jun 12 2014
parent reply "Rene Zwanenburg" <renezwanenburg gmail.com> writes:
On Thursday, 12 June 2014 at 22:14:23 UTC, captaindet wrote:
 On 2014-06-12 14:20, captaindet wrote:

 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.
thanks andrew, philippe, i had the suspicion that it is a windows only problem anyway because the only thing that an unused std.file would do is pulling a lot of windows specific stuff (on my system). if now someone could test this with the current DMD on windows, 64 and 32 bit executables... /det
No problems with 2.065 on win, both 32 and 64 bit.
Jun 12 2014
parent captaindet <2krnk gmx.net> writes:
On 2014-06-12 17:27, Rene Zwanenburg wrote:
 On Thursday, 12 June 2014 at 22:14:23 UTC, captaindet wrote:
 On 2014-06-12 14:20, captaindet wrote:

 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.
thanks andrew, philippe, i had the suspicion that it is a windows only problem anyway because the only thing that an unused std.file would do is pulling a lot of windows specific stuff (on my system). if now someone could test this with the current DMD on windows, 64 and 32 bit executables... /det
No problems with 2.065 on win, both 32 and 64 bit.
great, thanks, so no need to file a bug report. some other bugfix seemed to have taken care of the issue alongside. (in the meantime i had the bug confirmed on another win7/64 machine, however, using DMD2.0642 again.) hopefully it is still fixed in 2.066 which will be my next upgrade step once it is out. /det
Jun 12 2014