[OT] OT: Null checks.

Timon Gehr timon.gehr at gmx.ch
Wed May 7 00:27:05 UTC 2025


On 5/7/25 01:36, Walter Bright wrote:
> On 5/6/2025 8:34 AM, Timon Gehr wrote:
>> - There are `assert(0)` in druntime.
>> - Druntime/Phobos ship as `-release` build.
>>
>> Therefore, setting the assert handler will do nothing, even if you 
>> configure checkaction to call it in your own project.
> 
> Change the `-release` in building druntime to `-release -checkaction=D`.
> 

```d
void main(){
     assert(0);
}
```

```
$ dmd -release -checkaction=D -run test.d
Error: program killed by signal 4
```

The invalid instruction is in `_Dmain`, not druntime, so this is a valid 
demonstration even without building a custom druntime.

If I am going to build a custom druntime, I will simply delete `-release`.


We should aim to do this in general, delete `-release` and still replace 
all reachable `assert(0)` for good measure.


More information about the Digitalmars-d mailing list