Bug 20533 – static immutable variable broken on windows-x86-dmd

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2020-01-26T03:09:24Z
Last change time
2024-12-13T19:06:57Z
Assigned to
No Owner
Creator
SHOO
Moved to GitHub: dmd#17936 →

Comments

Comment #0 by zan77137 — 2020-01-26T03:09:24Z
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: ------ PATH=C:\D\dmd-2.090.0\windows\bin;%PATH% 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`
Comment #1 by robert.schadek — 2024-12-13T19:06:57Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17936 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB