Guidelines for Enforcing Bounds-Checking
The use of the -debug
compiler flag enables all bounds-checking. Effectively, this is the equivalent of making the following settings in the compiler configuration file (default.conf
, for example):
-
#Bound Pointer and base vars
EC-BOUND-PTR: yes
-
#Field Subscript check Field(
idx
)
EC-BOUND-SUBSCRIPT:yes
-
#Field Ref check Field(
offset:len
)
EC-BOUND-REF-MOD:yes
-
#Non-numeric data check for
PIC 9/USAGE COMP-3
target data items.
EC-DATA-INCOMPATIBLE:yes
If you want to enable/disable bounds checking for individual items you can do this via the configuration file. When compiling with -debug
, the default values for the above-mentioned compiler configuration flags would all be set to "yes". Re-setting a flag to "no" would override the -debug
compiler configuration flag.
In the absence of the -debug
compiler flag, the default values for the above-mentioned compiler configuration flags would all be set to "no". Re-setting a flag to "yes" would override the default behavior, and enable a specific bounds-checking behavior.
Otherwise the default is for all bounds checking to be disabled.