[OT] OT: Null checks.
Timon Gehr
timon.gehr at gmx.ch
Sun May 4 04:49:48 UTC 2025
On 5/4/25 06:36, Walter Bright wrote:
>
>> You can go to d.godbolt.org, select "ldc latest CI", pass arguments "-
>> O" and confirm for yourself that `_Dmain` is simply this:
>> This is in accordance with the C standard.
>
> ldc should disable that particular behavior, as it has negative utility.
> No wonder you're having difficulties with it.
For the record, even if my application would not run very sluggishly
when compiled with DMD, in this particular case it does not matter how
accurate the segfault location is as I am not getting any information in
the first place.
My understanding is that null pointer dereference being UB is a
widespread assumption in the LLVM and GCC optimizers. Simply "disabling
the behavior" is not practical.
Perhaps I could add `-fsanitize=null` to add null checks, but that would
not really solve the main problem as it is not integrated with D scope
guards. It also would not lead to CPU virtual memory built-in features
being used for null checks.
More information about the Digitalmars-d
mailing list