3 ms·
When I dabbled in gfortran, a feature I liked was that while no bounds-checking is the default, run time bounds-checks can be enabled with "-fcheck=bounds" or "
by celrod 7y ago
When I dabbled in gfortran, a feature I liked was that while no bounds-checking is the default, run time bounds-checks can be enabled with "-fcheck=bounds" or "-fcheck=all", which can be handy while developing/testing code.
Alternatively, Julia has a macro "@inbounds" which disables checks, but this involves going through and annotating code after testing. You can also start Julia with the options "--check-bounds={yes|no}" to override declarations.
Running testsuites enables all checks.
Seems like it would be handy if these checks could be elided by defining a macro. Any reason this isn't done?
The performance cost is often much higher than the time spent repeatedly checking bounds. It tends to defeat the auto-vectorizer.
Another workaround is to manually check bounds before the loop. This lets the compiler prove all bounds checks pass if it gets to the loop, and solves the problem.
I do wish that sort of thing could be automatic.