Thread overview
[Issue 22020] The profile flag does not work in Windows.
Jun 14, 2021
RazvanN
Jun 18, 2021
lempiji@gmail.com
Jun 18, 2021
lempiji@gmail.com
Jun 18, 2021
lempiji@gmail.com
Jun 19, 2021
Hiroki Noda
Jun 19, 2021
lempiji@gmail.com
Jun 28, 2022
Steven Dwy
Jun 28, 2022
Steven Dwy
Dec 17, 2022
Iain Buclaw
June 14, 2021
https://issues.dlang.org/show_bug.cgi?id=22020

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305@gmail.com

--- Comment #1 from RazvanN <razvan.nitu1305@gmail.com> ---
Have you tried running the program without dub, just to make sure this is not a dub failure?

--
June 18, 2021
https://issues.dlang.org/show_bug.cgi?id=22020

--- Comment #2 from lempiji@gmail.com ---
The same thing happened when I ran app.exe as is.
I couldn't figure out how to build without using dub.

The link between mir-algorithm.lib and mir-core.lib seems to be necessary, and
the condition of occurrence is very difficult to understand.
Also, I replaced 'iota' with 'sliced' and got the same result.

The log for `dub run -v --single --build=profile app.d` looks like this. Some of the logs are in Japanese.

```
PS C:\work\dev\D\sandbox-mir> dub run -v --single --build=profile app.d
Using dub registry url 'https://code.dlang.org/'
Refreshing local packages (refresh existing: true)...
Looking for local package map at
C:\ProgramData\dub\packages\local-packages.json
Looking for local package map at
C:\Users\User\AppData\Local\dub\packages\local-packages.json
Try to load local package map at
C:\Users\User\AppData\Local\dub\packages\local-packages.json
Determined package version using GIT: my-skelton 0.0.2
Determined package version using GIT: lib-blas 1.0.0
Determined package version using GIT: lib-lapack 1.0.0
Note: Failed to determine version of package finance at .. Assuming ~master.
Determined package version using GIT: test-skelton 1.0.0
Determined package version using GIT: dagon 0.10.1+commit.145.g2f43d56
Determined package version using GIT: tfd 0.0.5+commit.2.g033292d
Determined package version using GIT: libfuture ~master
Determined package version using GIT: golem 0.7.0+commit.2.gf0e91a7
Note: Failed to determine version of package golemancer at .. Assuming ~master.
Determined package version using GIT: lightbulb ~master
Looking for local package map at
C:\work\dev\D\sandbox-mir\.dub\packages\local-packages.json
Determined package version using GIT: botan 1.12.19
Determined package version using GIT: botan-math 1.0.3+commit.4.g1b85c88
Determined package version using GIT: memutils 1.0.4+commit.2.g6701e32
Note: Failed to determine version of package sandbox-mir at .. Assuming
~master.
Refreshing local packages (refresh existing: false)...
Looking for local package map at
C:\ProgramData\dub\packages\local-packages.json
Looking for local package map at
C:\Users\User\AppData\Local\dub\packages\local-packages.json
Try to load local package map at
C:\Users\User\AppData\Local\dub\packages\local-packages.json
Determined package version using GIT: my-skelton 0.0.2
Determined package version using GIT: lib-blas 1.0.0
Determined package version using GIT: lib-lapack 1.0.0
Note: Failed to determine version of package finance at .. Assuming ~master.
Determined package version using GIT: test-skelton 1.0.0
Determined package version using GIT: dagon 0.10.1+commit.145.g2f43d56
Determined package version using GIT: tfd 0.0.5+commit.2.g033292d
Determined package version using GIT: libfuture ~master
Determined package version using GIT: golem 0.7.0+commit.2.gf0e91a7
Note: Failed to determine version of package golemancer at .. Assuming ~master.
Determined package version using GIT: lightbulb ~master
Looking for local package map at
C:\work\dev\D\sandbox-mir\.dub\packages\local-packages.json
  Found dependency mir-algorithm 3.10.60
    Found dependency mir-core 1.1.70
Refreshing local packages (refresh existing: false)...
Looking for local package map at
C:\ProgramData\dub\packages\local-packages.json
Looking for local package map at
C:\Users\User\AppData\Local\dub\packages\local-packages.json
Try to load local package map at
C:\Users\User\AppData\Local\dub\packages\local-packages.json
Determined package version using GIT: my-skelton 0.0.2
Determined package version using GIT: lib-blas 1.0.0
Determined package version using GIT: lib-lapack 1.0.0
Note: Failed to determine version of package finance at .. Assuming ~master.
Determined package version using GIT: test-skelton 1.0.0
Determined package version using GIT: dagon 0.10.1+commit.145.g2f43d56
Determined package version using GIT: tfd 0.0.5+commit.2.g033292d
Determined package version using GIT: libfuture ~master
Determined package version using GIT: golem 0.7.0+commit.2.gf0e91a7
Note: Failed to determine version of package golemancer at .. Assuming ~master.
Determined package version using GIT: lightbulb ~master
Looking for local package map at
C:\work\dev\D\sandbox-mir\.dub\packages\local-packages.json
  Found dependency mir-algorithm 3.10.60
    Found dependency mir-core 1.1.70
Generating using build
Configuring dependent app, deps:"mir-algorithm"
  Configuring dependent mir-algorithm, deps:"mir-core"
    Configuring dependent mir-core, deps:
Performing "profile" build using C:\D\dmd2\windows\bin64\dmd.exe for x86_64.
mir-core 1.1.70: target for configuration "library" is up to date.
Using existing build in
C:\Users\User\AppData\Local\dub\packages\mir-core-1.1.70\mir-core\.dub\build\library-profile-windows-x86_64-dmd_v2.097.0-dirty-D627CE87F82063401DAD5E4C3043F56C\.
Copying target from
C:\Users\User\AppData\Local\dub\packages\mir-core-1.1.70\mir-core\.dub\build\library-profile-windows-x86_64-dmd_v2.097.0-dirty-D627CE87F82063401DAD5E4C3043F56C\mir-core.lib
to C:\Users\User\AppData\Local\dub\packages\mir-core-1.1.70\mir-core
mir-algorithm 3.10.60: target for configuration "default" is up to date.
Using existing build in
C:\Users\User\AppData\Local\dub\packages\mir-algorithm-3.10.60\mir-algorithm\.dub\build\default-profile-windows-x86_64-dmd_v2.097.0-dirty-687726DACCEA92C05C74272DCD97EAC4\.
Copying target from
C:\Users\User\AppData\Local\dub\packages\mir-algorithm-3.10.60\mir-algorithm\.dub\build\default-profile-windows-x86_64-dmd_v2.097.0-dirty-687726DACCEA92C05C74272DCD97EAC4\mir-algorithm.lib
to C:\Users\User\AppData\Local\dub\packages\mir-algorithm-3.10.60\mir-algorithm
File '.' modified, need rebuild.
app ~master: building configuration "application"...
C:\D\dmd2\windows\bin64\dmd.exe -m64 -c
-of.dub\build\application-profile-windows-x86_64-dmd_v2.097.0-dirty-65C579894C2BC0DD48D19A35BCFC5075\app.obj
-g -inline -O -profile -w -version=Have_app -version=Have_mir_algorithm
-version=Have_mir_core
-IC:\Users\User\AppData\Local\dub\packages\mir-algorithm-3.10.60\mir-algorithm\source
-IC:\Users\User\AppData\Local\dub\packages\mir-core-1.1.70\mir-core\source
app.d -vcolumns
Linking...
C:\D\dmd2\windows\bin64\dmd.exe
-of.dub\build\application-profile-windows-x86_64-dmd_v2.097.0-dirty-65C579894C2BC0DD48D19A35BCFC5075\app.exe
.dub\build\application-profile-windows-x86_64-dmd_v2.097.0-dirty-65C579894C2BC0DD48D19A35BCFC5075\app.obj
C:\Users\User\AppData\Local\dub\packages\mir-algorithm-3.10.60\mir-algorithm\.dub\build\default-profile-windows-x86_64-dmd_v2.097.0-dirty-687726DACCEA92C05C74272DCD97EAC4\mir-algorithm.lib
C:\Users\User\AppData\Local\dub\packages\mir-core-1.1.70\mir-core\.dub\build\library-profile-windows-x86_64-dmd_v2.097.0-dirty-D627CE87F82063401DAD5E4C3043F56C\mir-core.lib
-m64 -g
LINK : 前回のインクリメンタル リンクで
.dub\build\application-profile-windows-x86_64-dmd_v2.097.0-dirty-65C579894C2BC0DD48D19A35BCFC5075\app.exe
が見つからなかったか、ビル
ドされませんでした。フル リンクを行います。
Copying target from
C:\work\dev\D\sandbox-mir\.dub\build\application-profile-windows-x86_64-dmd_v2.097.0-dirty-65C579894C2BC0DD48D19A35BCFC5075\app.exe
to C:\work\dev\D\sandbox-mir
To force a rebuild of up-to-date targets, run again with --force.
Running app.exe
Program exited with code -1073741819
```

--
June 18, 2021
https://issues.dlang.org/show_bug.cgi?id=22020

--- Comment #3 from lempiji@gmail.com ---
By the way, when I rewrote the sample code, I was able to reproduce this as well.

- If delete the dependency in dub.sdl, it won't reproduced.
- If delete import std.stdio and writeln, it won't reproduced.
- If delete &arr[0]; in getptr, it won't reproduced.

```
/+ dub.sdl:
        dependency "mir-algorithm" version="*"
+/
import std.stdio;

void main()
{
        writeln(getptr(new byte[10]));
}

byte* getptr(byte[] arr)
{
        return &arr[0];
}
```

--
June 18, 2021
https://issues.dlang.org/show_bug.cgi?id=22020

--- Comment #4 from lempiji@gmail.com ---
I have been informed that this is not reproduced in dmd 2.089.1.

https://twitter.com/mattn_jp/status/1405937529090572289


If it is regression, there are three commits that are likely to apply.

- https://github.com/dlang/druntime/commit/fe4f3019324ff005049177aabd2e8bf0e3bfeeb1 - https://github.com/dlang/druntime/commit/cf40a3283df44e943bfc37ff2d7e3368d7e0854f - https://github.com/dlang/druntime/commit/0a1de8e35c4a572ff7bb35824b795d102192d30d


I think this part is suspicious.

https://github.com/dlang/druntime/commit/cf40a3283df44e943bfc37ff2d7e3368d7e0854f#diff-58b0479d390fb9dd50b0b9c04b74e7cb4062af4823f8d52ebcde7cc7cd167ac0L488-R549

--
June 19, 2021
https://issues.dlang.org/show_bug.cgi?id=22020

Hiroki Noda <kubo39@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kubo39@gmail.com

--- Comment #5 from Hiroki Noda <kubo39@gmail.com> ---
I doubt this is beacause using synchronized (via trace_init) before calling
rt_init.

--
June 19, 2021
https://issues.dlang.org/show_bug.cgi?id=22020

--- Comment #6 from lempiji@gmail.com ---
I was able to minimize the reproducing code, dub was not involved.

app.d:
```
import std.stdio;

void main()
{
    auto arr = new byte[10];
    writeln(arr);
}
```

test.d:
```
module test;

struct Test {
    string msg;
}
```

build&run:
```
dmd.exe -lib -of"test.lib" -profile test.d
dmd.exe -c -of"app.obj" -profile app.d
dmd.exe -of"app.exe" app.obj test.lib
app.exe
```

--
June 28, 2022
https://issues.dlang.org/show_bug.cgi?id=22020

Steven Dwy <me@yoplitein.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |me@yoplitein.net

--- Comment #7 from Steven Dwy <me@yoplitein.net> ---
I have encountered this with DMD 2.100.0. It seems to be caused by passing
pointers/slices to `std.format`:
```
void main()
{
        import std.format;
        string x = "%s".format(null);
}
```

Run with `dmd -profile -run file.d`. Other flags seem to have no effect.

--
June 28, 2022
https://issues.dlang.org/show_bug.cgi?id=22020

--- Comment #8 from Steven Dwy <me@yoplitein.net> ---
Further investigation suggests `__equals` may be to blame:
```
int main()
{
        import std.random; // to defeat constant folding
        auto a = new int[4];
        foreach(ref v; a) v = uniform(0, 10);
        auto b = new int[4];
        foreach(ref v; b) v = uniform(0, 10);
        return cast(int)(a == b);
}
```

This is further supported by debugging a faulty binary, with the debugger
stopping on the first overload of __equals:
https://github.com/dlang/druntime/blob/cf3f7fe/src/core/internal/array/equality.d#L20-L48

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=22020

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P2

--