Compiling to eliminate overflows with 0.31.0

Observed a run time overflow, after getting modified old code to compile with new 0.31.0.

I saw in the blogpost, that

If the new default behavior is blocking you, use -Ddisable_overflow to 
keep the same semantics as in 0.30 or -Dskip_crystal_compiler_rt to 
not include out compiler-rt port and link against another build of it. The 
disable_overflow flag is temporal and it will go away. Read more at #8170.

I tried that, and all I get is unknown command error.

Can you give examples of how to use the commands correctly to turn off new overflow check.

crystal build program.cr -Ddisable_overflow

or

crystal build -Ddisable_overflow program.cr

or

crystal program.cr -Ddisable_overflow

but NOT:

crystal -Ddisable_overflow build program.cr

NOR:

crystal -Ddisable_overflow program.cr

because the first argument to crystal is the command (which is probably the error you are getting)

5 Likes

Thank you!

Not only did that eliminate the run time overflows, all my benchmarks run faster now than before compiling without overflow checks. The 0.31.0 version is now generally all around faster than with 0.30.x.

When I get a chance I’ll play with using multi-threading. I have a perfect numerical algorithm for that.