[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#429657: uses abs() instead of labs()



clone 429657 -1
reassign -1 abuse-sdl
retitle -1 uses abs() instead of labs()
quit

abuse-sdl-0.7.0 has a gun aiming problem due to a mis-optimisation.
attached is a canned example.

The "dx" and "dy" are defined as longs, so you have to use rather
labs() (and #include <stdlib.h> to get the prototype).
The example code with labs() compiles fine under "-O2",
also example code with "long" changed to "int" compiles fine.

On the other hand, on i386 is sizeof(int) == sizeof(long),
so there might be still problem also in gcc-4.1.

Petr



Reply to: