dub segfault and range error handling
jfondren
julian.fondren at gmail.com
Thu Sep 16 21:03:22 UTC 2021
On Thursday, 16 September 2021 at 20:49:28 UTC, seany wrote:
> I compile with : `dub build -b release --compiler=ldc2`
> The result executing the compiled binary 'myproj' is is (
> whether `writeln (a[1])` is uncommented, or the `test()`
> function is uncommented) some random number, usually negative
> with large absolute value, such as `-1894658200` .
> If this is embedded in a class, then the result is segfault.
>
> Is this expected behavior?
Yes. You have a -release build, "defaulting to disabled
asserts/contracts/invariants, and bounds checks in @safe
functions only", and you have an array out of bounds in a @system
function, so your array out of bounds goes unchecked.
More information about the Digitalmars-d-learn
mailing list