digitalmars.D.learn - Code compiles and run fine with LDC but segfault with DMD
- ryuukk_ (24/24) Aug 29 2022 The following code compiles and run fine with LDC, but with DMD
- ryuukk_ (4/4) Aug 29 2022 I forgot to add: this is on Windows, the problem doesn't exist
- zjh (2/3) Aug 29 2022 I guess it's global sharing. not `tls`.
- wjoe (3/4) Aug 30 2022 This flag adds symbolic debug info. But I'm confident you knew
- ryuukk_ (2/6) Aug 30 2022 You didn't understand the question
- ryuukk_ (3/3) Aug 30 2022 Problem fixed, i had to copy bunch of other code from druntime
The following code compiles and run fine with LDC, but with DMD it compiles and then default at runtime ```D -- app.d enum Test {A, B, C} Test test = Test.A; extern(C) void main() { switch(test) { default: break; } } ``` ``` -- object.d // empty for now ``` `dmd -m64 app.d && ./app.exe` compiles, running it segfault ⛔ `ldc2 -m64 app.d && ./app.exe` compiles, running it works ✅ Now the interesting part `dmd -g -m64 app.d && ./app.exe` compiles, running it works! ✅ What `-g` does that makes this code compile and work with DMD?
Aug 29 2022
I forgot to add: this is on Windows, the problem doesn't exist with linux I reported a bug here: https://issues.dlang.org/show_bug.cgi?id=23310
Aug 29 2022
On Monday, 29 August 2022 at 21:46:48 UTC, ryuukk_ wrote:What `-g` does that makes this code compile and work with DMD?I guess it's global sharing. not `tls`.
Aug 29 2022
On Monday, 29 August 2022 at 21:46:48 UTC, ryuukk_ wrote:What `-g` does that makes this code compile and work with DMD?This flag adds symbolic debug info. But I'm confident you knew that already.
Aug 30 2022
On Tuesday, 30 August 2022 at 11:24:21 UTC, wjoe wrote:On Monday, 29 August 2022 at 21:46:48 UTC, ryuukk_ wrote:You didn't understand the questionWhat `-g` does that makes this code compile and work with DMD?This flag adds symbolic debug info. But I'm confident you knew that already.
Aug 30 2022
Problem fixed, i had to copy bunch of other code from druntime Here is a working object.d: https://gist.github.com/ryuukk/53c133f29da5a8326c359a6bb1063207
Aug 30 2022