Re: looking for work-around: _d_assocarrayliteralTX segfault assigning a shared associative array an AA literal

2023-06-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/13/23 10:14 PM, Steven Schveighoffer wrote: If there isn't a bug I'll file one. OMG I didn't even see that the first line of your post is the bug report! I added to it. -Steve

Re: looking for work-around: _d_assocarrayliteralTX segfault assigning a shared associative array an AA literal

2023-06-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/13/23 10:02 PM, Steven Schveighoffer wrote: I need to diagnose further, but most *likely* the problem is that the typeinfo being passed is incorrect (I believe it's a TypeInfo_Shared, but the function is expecting a TypeInfo_AssociativeArray) Further diagnosis is that the `TypeInfo`

Re: looking for work-around: _d_assocarrayliteralTX segfault assigning a shared associative array an AA literal

2023-06-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/13/23 1:06 PM, mw wrote: Does anyone know how to fix it? or any work-around? Built a debug version of dmd/druntime, the failure is here: https://github.com/dlang/dmd/blob/342a226833a0e9c7a90bbb64ae8dc35aa6d6bfdc/druntime/src/rt/aaA.d#L766 The line is: ```d immutable keysz =

Re: looking for work-around: _d_assocarrayliteralTX segfault assigning a shared associative array an AA literal

2023-06-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/13/23 8:02 PM, mw wrote: On Tuesday, 13 June 2023 at 22:21:10 UTC, Steven Schveighoffer wrote: As far as I can tell, this problem has been occurring for a long time. BTW, you don't need to define it in global space, just: ```d void main() {    shared aa = ["abc": "123"]; } ``` I have

Union with bits ?

2023-06-13 Thread Paul via Digitalmars-d-learn
I would like to have labeled bits in a union with a ubyte. Something like this: ```d struct MyStruct { union { ubyte status; bit A, B, C…etc } } ``` Is something like this possible? Thanks

Re: looking for hint to debug a strange multi-thread bug (grpc-d-core)

2023-06-13 Thread mw via Digitalmars-d-learn
UPDATE: life is too short to debug dlang built-in AA to right, let's just use HashMap from emsi_containers https://github.com/mw66/grpc-d/blob/master/source/grpc/server/package.d#L25 ``` HashMap!(string, ServiceHandlerInterface) services; ``` After this change, the problem goes away. I think

Re: looking for work-around: _d_assocarrayliteralTX segfault assigning a shared associative array an AA literal

2023-06-13 Thread mw via Digitalmars-d-learn
On Tuesday, 13 June 2023 at 22:21:10 UTC, Steven Schveighoffer wrote: As far as I can tell, this problem has been occurring for a long time. BTW, you don't need to define it in global space, just: ```d void main() { shared aa = ["abc": "123"]; } ``` I have to ask the old-timers on this

looking for hint to debug a strange multi-thread bug (grpc-d-core)

2023-06-13 Thread mw via Digitalmars-d-learn
Hi, I recently found and started playing with the grpc-d-core[1] package, and my program structure looks like this: https://github.com/mw66/grpc-demo/blob/master/source/main.d If I run L64 alone (without L66 ~ 79 grpc-d part): ``` 64: auto t = new Thread({fun();}).start(); ``` it works fine.

Re: compile-time detection of all pointer types in one test

2023-06-13 Thread DLearner via Digitalmars-d-learn
On Sunday, 11 June 2023 at 21:32:11 UTC, Andy wrote: [...] void main() { import std.stdio; struct foo {} foo* fooptr; static if (is(typeof(fooptr) == T*, T)) writeln("fooptr is a pointer to a ", T.stringof); else

Re: looking for work-around: _d_assocarrayliteralTX segfault assigning a shared associative array an AA literal

2023-06-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/13/23 1:06 PM, mw wrote: https://issues.dlang.org/show_bug.cgi?id=20812 JR 2020-05-08 19:17:02 UTC Manjaro/Arch x86_64, dmd 2.091.1. ldc does not seem to be affected. GDC also fails. ``` shared string[string] aa; void main() {     aa = [ "abc" : "123" ]; } ``` Program received

Re: looking for work-around: _d_assocarrayliteralTX segfault assigning a shared associative array an AA literal

2023-06-13 Thread mw via Digitalmars-d-learn
On Tuesday, 13 June 2023 at 17:12:41 UTC, Anonymouse wrote: On Tuesday, 13 June 2023 at 17:06:55 UTC, mw wrote: Does anyone know how to fix it? or any work-around? Thanks. I don't know if it's *correct* or not, but I think I did this at the time to work around it. ``` shared

Re: looking for work-around: _d_assocarrayliteralTX segfault assigning a shared associative array an AA literal

2023-06-13 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 13 June 2023 at 17:06:55 UTC, mw wrote: Does anyone know how to fix it? or any work-around? Thanks. I don't know if it's *correct* or not, but I think I did this at the time to work around it. ``` shared string[string] aa; void main() { auto aaTemp = [ "abc" : "123" ];

Re: assert/static assert message format difference

2023-06-13 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 13 June 2023 at 16:46:26 UTC, DLearner wrote: Only a small thing, but is it intended that: ``` void main() { // static assert (false, "Static Assert triggered"); assert(false, "Assert triggered"); } ``` produces ``` core.exception.AssertError@staticassertex01.d(4): Assert

assert/static assert message format difference

2023-06-13 Thread DLearner via Digitalmars-d-learn
Only a small thing, but is it intended that: ``` void main() { // static assert (false, "Static Assert triggered"); assert(false, "Assert triggered"); } ``` produces ``` core.exception.AssertError@staticassertex01.d(4): Assert triggered ``` but removing the // produces ```