www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20533] New: static immutable variable broken on windows-x86-dmd


          Issue ID: 20533
           Summary: static immutable variable broken on windows-x86-dmd
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: zan77137 nifty.com

When using dub as a library, I encountered a strange phenomenon that can only
be reproduced in a windows-x86-dmd environment.
Following is a batch process that reproduces this phenomenon:

dub init . dub -t minimal -f json -n -q

echo import std.stdio, dub.dub;                              >  source\app.d
echo unittest {                                              >> source\app.d
echo   auto dub = new Dub(".");                              >> source\app.d
echo   dub.loadPackage();                                    >> source\app.d
echo   writeln(dub.project.rootPackage.version_.toString()); >> source\app.d
echo }                                                       >> source\app.d
echo void main() {}                                          >> source\app.d

dub test -a=x86 --coverage -f

According to my research, the static immutable variable
`dub.dependency.Version.masterBranch`, which is referred to when determining
the root package version when during `dub.loadPackage()`, is broken for some
reason. (Curiously the string "dub.json" is referenced)

--- dub.package_ ---
106:    // TODO: Assume unknown version here?
107:    // recipe.version_ = Version.unknown.toString();
108:    recipe.version_ = Version.masterBranch.toString();

Following are some other reproduction conditions I have found:

- The same happens at least at 2.086.1 (I haven't looked elsewhere, but it
seems to be a potential problem)
- It is NOT reproduced when building without `--coverage`.
- It is NOT reproduced when building with `--build-mode=singleFile`.
- The address of dub.dependency.Version.masterBranch is different when it is
referenced between `dub.package_` and `source/app.d`

Jan 25