bmx-ng / bcc

A next-generation bcc parser for BlitzMax
zlib License
33 stars 13 forks source link

"division by zero": Floating point exception (core dumped) #609

Closed GWRon closed 1 year ago

GWRon commented 1 year ago

Seems the debugger does not kick in if you do a "div by zero". Happens for x mod zeroValue and also x / zeroValue.

SuperStrict
Framework Brl.StandardIO

'code layout to check if debugger highlights correct line
Local i:Int = 1
Select i
    Case 1
        'trying this: "Compile Error: Integer division by zero"
        'Local X:Int = 0 Mod 0

        'div by zero - "Floating point exception (core dumped)"
        Local a:Int = 0, b:Int = 0
        Local X:Int = a Mod b

    'this line is what gdb would highlight (not the modulo line above)
    Case 2
        'nothing
End Select

So "mod 0" is caught before compiling. Good. But if you hide the "zero" the calculation is not caught. Same happens for "x / y". Means any "hidden" division by zero is currently not caught by the debugger.

GWRon commented 1 year ago

Assume this is something the developer has to care for on their own (div by zero...)