Re: Bug in DMD?

2023-03-02 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 3 March 2023 at 01:37:42 UTC, Richard (Rikki) Andrew Cattermole wrote: On 03/03/2023 2:33 PM, ryuukk_ wrote: So it is a DMD bug? Yes and thanks to you I can now say that we can absolutely get rid of DllMain requirement for DLLs! glad the outcome is positive, and i apologies about

Re: Bug in DMD?

2023-03-02 Thread Vladimir Panteleev via Digitalmars-d-learn
an be summarized as "that's what ends up happening due to the details of the implementation". 4. is this a bug in DMD or my code is wrong? I would say the code is wrong in principle, though as you've noted it can still work in some specific circumstances. 5. if it's w

Re: Bug in DMD?

2023-03-02 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
I added a note here: https://issues.dlang.org/show_bug.cgi?id=20737

Re: Bug in DMD?

2023-03-02 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 03/03/2023 2:33 PM, ryuukk_ wrote: So it is a DMD bug? Yes and thanks to you I can now say that we can absolutely get rid of DllMain requirement for DLLs!

Re: Bug in DMD?

2023-03-02 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 3 March 2023 at 01:24:42 UTC, Richard (Rikki) Andrew Cattermole wrote: This works: ```d extern(C) void main() { Stuff[5] temp = [ Stuff(), Stuff(), Stuff(), Stuff(), Stuff(), ]; stuffs = temp[]; stuffs[0].do_something(); } ``` `

Re: Bug in DMD?

2023-03-02 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
This works: ```d extern(C) void main() { Stuff[5] temp = [ Stuff(), Stuff(), Stuff(), Stuff(), Stuff(), ]; stuffs = temp[]; stuffs[0].do_something(); } ``` ```d Stuff[] stuffs; ``` The problem here is dmd isn't initializing TLS with a valu

Re: Bug in DMD?

2023-03-02 Thread ryuukk_ via Digitalmars-d-learn
ep? 3. why it doesn't work when DMD is invoked once for build/link 4. is this a bug in DMD or my code is wrong? 5. if it's wrong, then why does it compile/no error? ```sh #!/usr/bin/env bash set -e build_dmd() { echo "build dmd" dmd \ -debug -g \ -

Re: Bug in DMD?

2023-03-02 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 3 March 2023 at 01:07:07 UTC, ryuukk_ wrote: I couldn't figure out dustmite, so i started from 0 and managed to hit something: https://github.com/ryuukk/dmd_bug ``Assertion failed: array index out of bounds, file game\app.d, line 5`` Wich indicates probably TLS problem? Yeah...

Re: Bug in DMD?

2023-03-02 Thread ryuukk_ via Digitalmars-d-learn
I couldn't figure out dustmite, so i started from 0 and managed to hit something: https://github.com/ryuukk/dmd_bug ``Assertion failed: array index out of bounds, file game\app.d, line 5`` Wich indicates probably TLS problem? This now reminds me of: https://issues.dlang.org/show_bug.cgi?id

Re: Bug in DMD?

2023-03-02 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 03/03/2023 10:38 AM, ryuukk_ wrote: On Thursday, 2 March 2023 at 21:21:14 UTC, Richard (Rikki) Andrew Cattermole wrote: There isn't anything we can do without source. But here is what I would do in this situation: 1. Look at the assembly at the point of debug break, from here it should giv

Re: Bug in DMD?

2023-03-02 Thread Ali Çehreli via Digitalmars-d-learn
On 3/2/23 15:34, ryuukk_ wrote: > the problem is not that it can run in the background, the problem is > figuring out > > 1. how to install > 2. how to setup > 3. how to run I haven't used it myself but dustmite seems to be integrated into dub. 'dub dustmite <...>' Ali

Re: Bug in DMD?

2023-03-02 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 03/03/2023 12:34 PM, ryuukk_ wrote: 1. how to install Already is. Comes with dmd and ldc. You can also just do ``$ dub run digger -- args``. 2. how to setup > 3. how to run It is a bit of a pain but the basics is you need some sort of compilation command, list of sources and a test to

Re: Bug in DMD?

2023-03-02 Thread ryuukk_ via Digitalmars-d-learn
On Thursday, 2 March 2023 at 22:24:11 UTC, H. S. Teoh wrote: On Thu, Mar 02, 2023 at 09:55:55PM +, ryuukk_ via Digitalmars-d-learn wrote: On Thursday, 2 March 2023 at 21:38:23 UTC, ryuukk_ wrote: > On Thursday, 2 March 2023 at 21:21:14 UTC, Richard (Rikki) > Andrew > Cattermole wrote: [..

Re: Bug in DMD?

2023-03-02 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Mar 02, 2023 at 09:55:55PM +, ryuukk_ via Digitalmars-d-learn wrote: > On Thursday, 2 March 2023 at 21:38:23 UTC, ryuukk_ wrote: > > On Thursday, 2 March 2023 at 21:21:14 UTC, Richard (Rikki) Andrew > > Cattermole wrote: [...] > > > 2. Dustmite, so we have something we can work with. >

Re: Bug in DMD?

2023-03-02 Thread ryuukk_ via Digitalmars-d-learn
On Thursday, 2 March 2023 at 21:38:23 UTC, ryuukk_ wrote: On Thursday, 2 March 2023 at 21:21:14 UTC, Richard (Rikki) Andrew Cattermole wrote: There isn't anything we can do without source. But here is what I would do in this situation: 1. Look at the assembly at the point of debug break, from

Re: Bug in DMD?

2023-03-02 Thread ryuukk_ via Digitalmars-d-learn
On Thursday, 2 March 2023 at 21:21:14 UTC, Richard (Rikki) Andrew Cattermole wrote: There isn't anything we can do without source. But here is what I would do in this situation: 1. Look at the assembly at the point of debug break, from here it should give you hints as to why its trying to writ

Re: Bug in DMD?

2023-03-02 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
There isn't anything we can do without source. But here is what I would do in this situation: 1. Look at the assembly at the point of debug break, from here it should give you hints as to why its trying to write to dawn.assets.Resource init array. 2. Dustmite, so we have something we can work

Re: Bug in DMD?

2023-03-02 Thread ryuukk_ via Digitalmars-d-learn
It crashes with a weird message, address doesn't match the mangled name: ``C:\dev\kdom\projects\dawn\gl\glad\loader.d`` inside: ``module dawn.gl.glad.loader;`` ![screenshot](https://i.imgur.com/sY2KcgR.png)

Bug in DMD?

2023-03-02 Thread ryuukk_ via Digitalmars-d-learn
Hello, I encountered a weird issue, my program segfault when i feed DMD with my files and static libs It doesn't when i compile with LDC If i split the compile/link in 2 different steps, then all works correctly DMD (1step: ⛔): https://gist.github.com/ryuukk/f0ae2ae0c8980219c04d0c6d86789

Re: Bug in dmd?

2022-06-16 Thread Andrey Zherikov via Digitalmars-d-learn
On Wednesday, 15 June 2022 at 16:53:13 UTC, mw wrote: Create a simple test case, file bug at: https://issues.dlang.org/ I tried. No luck.

Re: Bug in dmd?

2022-06-15 Thread mw via Digitalmars-d-learn
Create a simple test case, file bug at: https://issues.dlang.org/

Re: Bug in dmd?

2022-06-15 Thread Andrey Zherikov via Digitalmars-d-learn
On Wednesday, 15 June 2022 at 09:24:35 UTC, Dukc wrote: Now when I think of it, perhaps the fact that private `printHelp` has the same name as the public `printHelp` is somehow confusing dmd. If you try to rename the private `printHelp` and it's call in the public one to something else, you mi

Re: Bug in dmd?

2022-06-15 Thread Andrey Zherikov via Digitalmars-d-learn
On Wednesday, 15 June 2022 at 09:21:28 UTC, user1234 wrote: On Tuesday, 14 June 2022 at 13:39:12 UTC, Andrey Zherikov wrote: I have [pretty simple code in my library](https://github.com/andrey- [Line (2) produces](https://github.com/andrey-zherikov/argparse/runs/6880350900?check_suite_focus=tru

Re: Bug in dmd?

2022-06-15 Thread Andrey Zherikov via Digitalmars-d-learn
On Wednesday, 15 June 2022 at 07:38:36 UTC, JG wrote: I tried to reproduce it but wasn't able (I guess it is some interplay with the rest of your code): I tried this first but got the same result as you. I think my small library overheats DMD's template engine.

Re: Bug in dmd?

2022-06-15 Thread Dukc via Digitalmars-d-learn
templates. This definitely triggers some bug in DMD because this `private void printHelp ...` function is not really `private` as it's called from [another module](https://github.com/andrey-zherikov/argparse/blob/bug/source/argparse/internal.d#L786) and DMD doesn't catch this. Now when

Re: Bug in dmd?

2022-06-15 Thread user1234 via Digitalmars-d-learn
On Tuesday, 14 June 2022 at 13:39:12 UTC, Andrey Zherikov wrote: I have [pretty simple code in my library](https://github.com/andrey- [Line (2) produces](https://github.com/andrey-zherikov/argparse/runs/6880350900?check_suite_focus=true#step:5:12) `undefined reference to '_D3std7sumtype__T7SumTy

Re: Bug in dmd?

2022-06-15 Thread JG via Digitalmars-d-learn
templates. This definitely triggers some bug in DMD because this `private void printHelp ...` function is not really `private` as it's called from [another module](https://github.com/andrey-zherikov/argparse/blob/bug/source/argparse/internal.d#L786) and DMD doesn't catch this. I tried to

Re: Bug in dmd?

2022-06-14 Thread Andrey Zherikov via Digitalmars-d-learn
On Tuesday, 14 June 2022 at 21:44:48 UTC, Dukc wrote: No idea. The functions seems indeed to be exactly the same, so I assume this is a DMD bug. It cannot be a bug in `std.sumtype`, since that would trigger in both of the templates. This definitely triggers some bug in DMD because this

Re: Bug in dmd?

2022-06-14 Thread Dukc via Digitalmars-d-learn
On Tuesday, 14 June 2022 at 13:39:12 UTC, Andrey Zherikov wrote: I have [pretty simple code in my library](https://github.com/andrey-zherikov/argparse/blob/bug/source/argparse/help.d#L27-L47): ```d alias CC = SumType!(AA,BB); struct AA {} struct BB { CC[] c; } private void ppp(T, Output)(au

Bug in dmd?

2022-06-14 Thread Andrey Zherikov via Digitalmars-d-learn
I have [pretty simple code in my library](https://github.com/andrey-zherikov/argparse/blob/bug/source/argparse/help.d#L27-L47): ```d alias CC = SumType!(AA,BB); struct AA {} struct BB { CC[] c; } private void ppp(T, Output)(auto ref Output output, in CommandArguments!T cmd, in Config config

Re: Is this a bug in dmd 2.067 for struct initializers?

2015-02-23 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, February 22, 2015 17:45:48 Ali Çehreli via Digitalmars-d-learn wrote: > On 02/22/2015 03:17 PM, Martin Nowak wrote: > > On Thursday, 19 February 2015 at 22:07:55 UTC, stewarth wrote: > >> I've gone with "static this()" approach and it works. > > > > You should use shared static this to i

Re: Is this a bug in dmd 2.067 for struct initializers?

2015-02-22 Thread stewarth via Digitalmars-d-learn
On Monday, 23 February 2015 at 04:04:08 UTC, ketmar wrote: On Mon, 23 Feb 2015 02:15:08 +, stewarth wrote: On Monday, 23 February 2015 at 02:10:09 UTC, amber wrote: On Sunday, 22 February 2015 at 23:17:33 UTC, Martin Nowak wrote: On Thursday, 19 February 2015 at 22:07:55 UTC, stewarth wro

Re: Is this a bug in dmd 2.067 for struct initializers?

2015-02-22 Thread ketmar via Digitalmars-d-learn
On Mon, 23 Feb 2015 02:15:08 +, stewarth wrote: > On Monday, 23 February 2015 at 02:10:09 UTC, amber wrote: >> On Sunday, 22 February 2015 at 23:17:33 UTC, Martin Nowak wrote: >>> On Thursday, 19 February 2015 at 22:07:55 UTC, stewarth wrote: I've gone with "static this()" approach and it

Re: Is this a bug in dmd 2.067 for struct initializers?

2015-02-22 Thread stewarth via Digitalmars-d-learn
On Monday, 23 February 2015 at 02:10:09 UTC, amber wrote: On Sunday, 22 February 2015 at 23:17:33 UTC, Martin Nowak wrote: On Thursday, 19 February 2015 at 22:07:55 UTC, stewarth wrote: I've gone with "static this()" approach and it works. You should use shared static this to initialize immut

Re: Is this a bug in dmd 2.067 for struct initializers?

2015-02-22 Thread amber via Digitalmars-d-learn
On Sunday, 22 February 2015 at 23:17:33 UTC, Martin Nowak wrote: On Thursday, 19 February 2015 at 22:07:55 UTC, stewarth wrote: I've gone with "static this()" approach and it works. You should use shared static this to initialize immutable variables. OK, thanks a lot for the help. Cheers,

Re: Is this a bug in dmd 2.067 for struct initializers?

2015-02-22 Thread Ali Çehreli via Digitalmars-d-learn
On 02/22/2015 03:17 PM, Martin Nowak wrote: On Thursday, 19 February 2015 at 22:07:55 UTC, stewarth wrote: I've gone with "static this()" approach and it works. You should use shared static this to initialize immutable variables. Is that because they are not thread-local? If so, initializing

Re: Is this a bug in dmd 2.067 for struct initializers?

2015-02-22 Thread Martin Nowak via Digitalmars-d-learn
On Thursday, 19 February 2015 at 22:07:55 UTC, stewarth wrote: I've gone with "static this()" approach and it works. You should use shared static this to initialize immutable variables.

Re: Is this a bug in dmd 2.067 for struct initializers?

2015-02-19 Thread stewarth via Digitalmars-d-learn
On Thursday, 19 February 2015 at 07:46:51 UTC, Ali Çehreli wrote: On 02/18/2015 10:39 PM, stewarth wrote: > This works under dmd 2066.1 but fails under dmd 2.067-b2. I don't know whether it is a bug. > struct B { > A* a; In any case, that must be immutable(A)*. > } > > static immutable

Re: Is this a bug in dmd 2.067 for struct initializers?

2015-02-18 Thread Ali Çehreli via Digitalmars-d-learn
On 02/18/2015 10:39 PM, stewarth wrote: > This works under dmd 2066.1 but fails under dmd 2.067-b2. I don't know whether it is a bug. > struct B { > A* a; In any case, that must be immutable(A)*. > } > > static immutable B[] someB = [{a:&someA[0]}, {a:&someA[1]}]; > I want it to initial

Is this a bug in dmd 2.067 for struct initializers?

2015-02-18 Thread stewarth via Digitalmars-d-learn
Hi All, This works under dmd 2066.1 but fails under dmd 2.067-b2. --- struct A { int val; } static immutable A[] someA = [{val:1}, {val:2}]; struct B { A* a; } static immutable B[] someB = [{a:&someA[0]}, {a:&someA[1]}]; void main() { writefln("a:%s", someA); writefln("b:%s"