[OT] OT: Null checks.

Nick Treleaven nick at geany.org
Fri May 9 12:11:06 UTC 2025


On Wednesday, 7 May 2025 at 23:10:56 UTC, Timon Gehr wrote:
> On 5/8/25 00:02, Walter Bright wrote:
>> Next, there's druntime being compiled with `-release`. What 
>> does that mean for the array bounds check:
>> ```
>> void main(){
>>       int[2] x=[0,1];
>>       auto y=x[1..2];
>>       x[]=y[];
>> }
>> ```
>> Compile with -vasm -release -check=on
>> ```
>> core.exception.RangeError at x.d(4): Range violation
>
> Yes, with DMD this command line works, but it seems LDC still 
> calls into a druntime assert(0).
>
> $ ./ldc2-1.41.0-beta1-linux-x86_64/bin/ldmd2 -release -check=on 
> -run test.d
> Error: /tmp/test-116bf6 failed with status: -2
>        message: Illegal instruction (core dumped)
> Error: program received signal 2 (Interrupt)

I think this is an LDC bug:
https://github.com/ldc-developers/ldc/issues/3793

It came up in the Learn forum recently:
https://forum.dlang.org/post/krzyhjmbzkhqgolpemxz@forum.dlang.org


More information about the Digitalmars-d mailing list