Interesting bug squashed

Started by iWasAdam, August 19, 2018, 14:03:35

Previous topic - Next topic

iWasAdam

I've been doing some housework taking an old blitzmax app and converting it to MX2.

It was a bit of a slog as the code was large and was doing some custom file format reading.
First was converting loads of const and data structure over and then onto the file reading itself.

The code worked, but was giving incorrect data.
After much time spent adding loads of debug traps to watch what was going on. the bug was found:

data as bytes and reading as bytes in blitzmax
data in MX2 needed to be UByte!

got trapped with the signs... but learn some interesting stuff along the way :)

col

I've been bitten by this kind of thing before too :)

I've also had one when using 3 x 32bit signed ints: Multiplying 2 of them then dividing by the 3rd was giving completely wrong results - randomly of course... cause was the first multiply overflowing past the signed 32bit range. The fix in this situation was to divide first ::)
https://github.com/davecamp

"When you observe the world through social media, you lose your faith in it."

iWasAdam

overflows and unpredictable results  :-X

It's great when something comes together. it even better when it does something completely unusual and not programmed (emerging behaviour) because of a bug...