What's the deal with -boundscheck?

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Sun Apr 5 19:13:45 PDT 2015


I've spent the better part of yesterday and today debugging a complex 
matter involving pointers, reduced to this:

../dmd/src/dmd -conf= -I../druntime/import  -w -dip25 -m64  -O -release 
-main -unittest generated/osx/release/64/libphobos2.a -defaultlib= 
-debuglib= -L-lcurl -run std/experimental/allocator/kernighan_ritchie.d

In this configuration, surprisingly there's no bounds checks inserted. I 
need to explicitly add -boundcheck=on.

Why the change? I've fought tooth and nail for keeping bounds checking 
in release mode and with optimizations on, precisely because I think 
it's a check that's valuable enough to warrant explicit disabling.

Could someone please explain. This is a shame.


Andrei


More information about the Digitalmars-d mailing list