Bug 3533 - Some calculations have different results in shared libraries/QVMs
Status: RESOLVED FIXED
Alias: None
Product: ioquake3
Classification: Unclassified
Component: Misc
Version: GIT MASTER
Hardware: All All
: P3 normal
Assignee: Zachary J. Slater
QA Contact: ioquake3 bugzilla mailing list
URL:
Depends on:
Blocks:
 
Reported: 2008-02-02 08:13 EST by Ben Millwood
Modified: 2009-11-08 12:05:24 EST
5 users (show)

See Also:



Description Ben Millwood 2008-02-02 08:13:28 EST
Thanks to the DnC team for drawing this to my attention (read it here: http://dnc.tremforges.net/trac/wiki/Features )

When running a server using gameppc.dylib, some damage values are calculated differently - most notably, the Dragoon's 100 damage pounce only does 99 to an unarmoured human, allowing them to survive.

The page linked above claims that the compiler flag -ffast-math is responsible for the issue, but I haven't confirmed this myself.
Comment 1 Amanieu d'Antras 2008-05-28 09:09:45 EDT
I confirm this bug is due to the use of -ffast-math. The bug does not occur when compiling without that compiler flag whilst keeping all other flags constant. -ffast-math should be removed from the Makefile.
Comment 2 Baybal 2009-03-28 12:51:47 EDT
fast math greases software part of rendering quite a lot!
Comment 3 Tim Angus 2009-10-17 19:30:15 EDT
Fixed in r1677.
Comment 4 Tim Angus 2009-10-17 19:39:19 EDT
Apparently this is not limited to OSX.
Comment 5 M. Kristall 2009-10-21 20:59:55 EDT
I think the specific optimization responsible is -fno-rounding-math. Try -frounding-math instead of removing -ffast-math, which would disable a number of other useful optimizations.

I've been informed that this should no longer occur in the specific cases mentioned and I'm not sure anyone else noticed it, so is this really necessary?
Comment 6 Thilo Schulz 2009-10-22 05:42:34 EDT
I suggest using separate C-Flags for building the QVM files, that have the -ffast-math removed. Maybe just strip the -ffast-math flag via some regex in the calls for compiling the QVMs in the Makefile? Could this be done portably?
Comment 7 Roman "kevlarman" Tetelman 2009-10-22 14:19:31 EDT
i would suggest making separate CFLAGS for everything, rather than trying to strip -ffast-math out. there's really no good reason for sdl-config --cflags to get into the server binary for example.
Comment 8 Thilo Schulz 2009-11-08 12:04:50 EST
Fixed in r1741
Comment 9 Thilo Schulz 2009-11-08 12:05:24 EST
Close this.