PreviousUpNext

5.4.27  Int Overflow Checking

The SML/NJ compiler traps integer overflow by default, but the Mythryl compiler does not, because this can slow down integer code by twenty percent or more. Integer overflow trapping can be enabled within a given sourcefile by putting the line

    #DO set_control "compiler::trap_int_overflow" "TRUE";

near the top of the file; any overflows during integer computations will then result in the OVERFLOW exception being raised.

If you want int overflow checking to be the default, you can change

        trap_int_overflow       = make_control (b, "trap_int_overflow",   "?", FALSE);

to

        trap_int_overflow       = make_control (b, "trap_int_overflow",   "?", TRUE);

in src/lib/compiler/toplevel/main/compiler-controls.pkg and recompile the compiler.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext