Bug 24380 – CTFE assert messages are replaced with "null" with -dip1008

Status
NEW
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2024-02-09T19:04:53Z
Last change time
2024-12-13T19:33:11Z
Assigned to
No Owner
Creator
JR
Moved to GitHub: dmd#18213 →

Comments

Comment #0 by zorael — 2024-02-09T19:04:53Z
EndeavourOS/Arch x86_64, dmd 2.107.0, ldc 1.36.0, also 1.37.0-beta1. The messages of asserts thrown during CTFE are replaced with "null" iff they were derived from a thrown exception's message and iff the program is built with -dip1008 enabled. ```d #!/usr/bin/env dub /+ dub.sdl: name "app" dflags "-dip1008" +/ void main() {} static immutable ctfeThing = { try { throw new Exception("message"); } catch (Exception e) { assert(0, e.msg); } return 0; }(); ``` ``` app.d(17,9): Error: null app.d(20,2): called from here: `(*function () pure nothrow @nogc @safe => 0)()` Error /usr/bin/dmd failed with exit code 1. ``` Expected is "Error: message", and you do get that if you disable -dip1008.
Comment #1 by zorael — 2024-02-10T13:36:25Z
The behaviour changed in 2.101, before which the error message was `"message"[0..7]`. ``` $ dub build --compiler=2.100/dmd 2>&1 | grep 'Error:' source/app.d(17,9): Error: `"message"[0..7]` $ dub build --compiler=2.101/dmd 2>&1 | grep 'Error:' source/app.d(17,9): Error: `null` ```
Comment #2 by contact — 2024-08-05T06:27:55Z
I can confirm regression: ``` 2.085.1 to 2.100.2: Failure with output: onlineapp.d(25): Error: static assert: "Incorrect format specifier for range: %d" Since 2.101.2: Success and no output ```
Comment #3 by robert.schadek — 2024-12-13T19:33:11Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18213 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB