Warzone2100 / old-trac-import

Archived Import of (old) Warzone 2100 Trac
0 stars 0 forks source link

CC builds for trunk are fubar #1786

Closed wzdev-ci closed 14 years ago

wzdev-ci commented 14 years ago

resolution_fixed type_bug | by Buginator


Cyp, got some time to make trunk builds, and they are screwed up when done with the CC compiler. Oddly enough, MSVC still works (at least, the game starts)


--- Starting log ---
error   |08:46:54: [i64Sqrt] Too badly broken sqrt function, i64Sqrt(18445618199572250625) = 4294836224.
error   |08:46:54: [i64Sqrt] Assert in Warzone: ../../../../lib/framework/trig.c:572 ((int64_t)(r*r - n) <= 0 && (int64_t)((r + 1)*(r + 1) - n) > 0), last script event: ''
error   |08:46:54: [i64Sqrt] Too badly broken sqrt function, i64Sqrt(18445618199572250625) = 4294836224.
error   |08:46:54: [i64Sqrt] Assert in Warzone: ../../../../lib/framework/trig.c:572 ((int64_t)(r*r - n) <= 0 && (int64_t)((r + 1)*(r + 1) - n) > 0), last script event: ''
error   |08:46:54: [trigInitialise] Sanity check failed, sqrt(18445618199572250625) gave 4294836224 instead of 4294836225!
error   |08:46:54: [trigInitialise] Assert in Warzone: ../../../../lib/framework/trig.c:55 ((uint32_t)i64Sqrt(lower) == test), last script event: ''
error   |08:46:54: [i64Sqrt] Too badly broken sqrt function, i64Sqrt(18445618208161923076) = 4294836225.
error   |08:46:54: [i64Sqrt] Assert in Warzone: ../../../../lib/framework/trig.c:572 ((int64_t)(r*r - n) <= 0 && (int64_t)((r + 1)*(r + 1) - n) > 0), last script event: ''
error   |08:46:54: [i64Sqrt] Too badly broken sqrt function, i64Sqrt(18445618208161923076) = 4294836225.
error   |08:46:54: [i64Sqrt] Assert in Warzone: ../../../../lib/framework/trig.c:572 ((int64_t)(r*r - n) <= 0 && (int64_t)((r + 1)*(r + 1) - n) > 0), last script event: ''
error   |08:46:54: [trigInitialise] Sanity check failed, sqrt(18445618208161923076) gave 4294836225 instead of 4294836226!
error   |08:46:54: [trigInitialise] Assert in Warzone: ../../../../lib/framework/trig.c:55 ((uint32_t)i64Sqrt(lower) == test), last script event: ''
error   |08:46:54: [i64Sqrt] Too badly broken sqrt function, i64Sqrt(18445618216751595529) = 4294836226.
error   |08:46:54: [i64Sqrt] Assert in Warzone: ../../../../lib/framework/trig.c:572 ((int64_t)(r*r - n) <= 0 && (int64_t)((r + 1)*(r + 1) - n) > 0), last script event: ''
error   |08:46:54: [i64Sqrt] Too badly broken sqrt function, i64Sqrt(18445618216751595529) = 4294836226.
error   |08:46:54: [i64Sqrt] Assert in Warzone: ../../../../lib/framework/trig.c:572 ((int64_t)(r*r - n) <= 0 && (int64_t)((r + 1)*(r + 1) - n) > 0), last script event: ''
error   |08:46:54: [trigInitialise] Sanity check failed, sqrt(18445618216751595529) gave 4294836226 instead of 4294836227!
error   |08:46:54: [trigInitialise] Assert in Warzone: ../../../../lib/framework/trig.c:55 ((uint32_t)i64Sqrt(lower) == test), last script event: ''
error   |08:46:54: [i64Sqrt] Too badly broken sqrt function, i64Sqrt(18445618225341267984) = 4294836227.
error   |08:46:54: [i64Sqrt] Assert in Warzone: ../../../../lib/framework/trig.c:572 ((int64_t)(r*r - n) <= 0 && (int64_t)((r + 1)*(r + 1) - n) > 0), last script event: ''
error   |08:46:54: [i64Sqrt] Too badly broken sqrt function, i64Sqrt(18445618225341267984) = 4294836227.
error   |08:46:54: [i64Sqrt] Assert in Warzone: ../../../../lib/framework/trig.c:572 ((int64_t)(r*r - n) <= 0 && (int64_t)((r + 1)*(r + 1) - n) > 0), last script event: ''
error   |08:46:54: [trigInitialise] Sanity check failed, sqrt(18445618225341267984) gave 4294836227 instead of 4294836228!
error   |08:46:54: [trigInitialise] Assert in Warzone: ../../../../lib/framework/trig.c:55 ((uint32_t)i64Sqrt(lower) == test), last script event: ''
error   |08:46:54: [i64Sqrt] Too badly broken sqrt function, i64Sqrt(18445618233930940441) = 4294836228.
error   |08:46:54: [i64Sqrt] Assert in Warzone: ../../../../lib/framework/trig.c:572 ((int64_t)(r*r - n) <= 0 && (int64_t)((r + 1)*(r + 1) - n) > 0), last script event: ''
error   |08:46:54: [i64Sqrt] Too badly broken sqrt function, i64Sqrt(18445618233930940441) = 4294836228.
error   |08:46:54: [i64Sqrt] Assert in Warzone: ../../../../lib/framework/trig.c:572 ((int64_t)(r*r - n) <= 0 && (int64_t)((r + 1)*(r + 1) - n) > 0), last script event: ''
error   |08:46:54: [trigInitialise] Sanity check failed, sqrt(18445618233930940441) gave 4294836228 instead of 4294836229!
error   |08:46:54: [trigInitialise] Assert in Warzone: ../../../../lib/framework/trig.c:55 ((uint32_t)i64Sqrt(lower) == test), last script event: ''
error   |08:46:54: [i64Sqrt] Too badly broken sqrt function, i64Sqrt(18445618242520612900) = 4294836229.
error   |08:46:54: [i64Sqrt] Assert in Warzone: ../../../../lib/framework/trig.c:572 ((int64_t)(r*r - n) <= 0 && (int64_t)((r + 1)*(r + 1) - n) > 0), last script event: ''
error   |08:46:54: [i64Sqrt] Too badly broken sqrt function, i64Sqrt(18445618242520612900) = 4294836229.
error   |08:46:54: [i64Sqrt] Assert in Warzone: ../../../../lib/framework/trig.c:572 ((int64_t)(r*r - n) <= 0 && (int64_t)((r + 1)*(r + 1) - n) > 0), last script event: ''
error   |08:46:54: [trigInitialise] Sanity check failed, sqrt(18445618242520612900) gave 4294836229 instead of 4294836230!
error   |08:46:54: [trigInitialise] Assert in Warzone: ../../../../lib/framework/trig.c:55 ((uint32_t)i64Sqrt(lower) == test), last script event: ''
error   |08:46:54: [i64Sqrt] Too badly broken sqrt function, i64Sqrt(18445618251110285361) = 4294836230.
error   |08:46:54: [i64Sqrt] Assert in Warzone: ../../../../lib/framework/trig.c:572 ((int64_t)(r*r - n) <= 0 && (int64_t)((r + 1)*(r + 1) - n) > 0), last script event: ''
error   |08:46:54: [i64Sqrt] Too badly broken sqrt function, i64Sqrt(18445618251110285361) = 4294836230.
error   |08:46:54: [i64Sqrt] Assert in Warzone: ../../../../lib/framework/trig.c:572 ((int64_t)(r*r - n) <= 0 && (int64_t)((r + 1)*(r + 1) - n) > 0), last script event: ''
error   |08:46:54: [trigInitialise] Sanity check failed, sqrt(18445618251110285361) gave 4294836230 instead of 4294836231!

I trimmed the log, since it was over 10MB and counting.

Ideas on what needs to be changed?


Issue migrated from trac:1786 at 2022-04-15 21:52:54 -0700

wzdev-ci commented 14 years ago

Buginator commented


also tried -mfpmath=sse -msse, and it didn't help.

error   |09:39:50: [i64Sqrt] Assert in Warzone: ../../../../lib/framework/trig.c:572 ((int64_t)(r*r - n) <= 0 && (int64_t)((r + 1)*(r + 1) - n) > 0), last script event: ''
error   |09:39:50: [trigInitialise] Sanity check failed, sqrt(18445618199572250625) gave 4294836224 instead of 4294836225!
wzdev-ci commented 14 years ago

Safety0ff commented


I did a test on my 32 bit system, using sqrtl it returns the proper value (4294836225,) using sqrt it returns 4294836224.

wzdev-ci commented 14 years ago

Safety0ff commented


The square root of 18445618199572250624 (18445618199572250625 adjusted to fit in the 53 bit floating point fraction,) is 4294836224.99999999988358112538. Since it gets rounded down ( 0.5f is not added,) it comes back and bites us here:

(int64_t)((r + 1)*(r + 1) - n) > 0

(zero not greater than zero)

wzdev-ci commented 14 years ago

Cyp commented


4294836224.99999999988358112538 is rounded up to 4294836225, before converting to uint64_t, since sqrt() returns a 53-bit fraction double.

It should work fine, as long as sqrt() takes a double and returns a double, or even takes a long double and returns a long double.

Sounds like as if it's taking a double and returning a long double...

Maybe add an assignment to a temporary volatile double before casting to uint64_t, inside an #ifdef CYGWIN block... (Would only be needed in i64Sqrt(), not in iSqrt().) Or try a different compiler version... Make sure it's not being compiled with -ffmath.

wzdev-ci commented 14 years ago

Safety0ff commented


You're right about the rounding and assigning to the volatile double worked.

wzdev-ci commented 14 years ago

Safety0ff commented


Using a function pointer worked as well.

wzdev-ci commented 14 years ago

Buginator commented


A small update, when the compiler is 32bit, it works as expected. If it is 64bit, then we get the above errors, and we do use -m32 as well.

wzdev-ci commented 14 years ago

Cyp commented


Hmmm, does newnet work when the cross-compiler is 32bit, then?

wzdev-ci commented 14 years ago

Buginator commented


Replying to Warzone2100/old-trac-import#1786 (comment:8):

Hmmm, does newnet work when the cross-compiler is 32bit, then?

When I was testing with you, that is what I was using.

It still doesn't work with MSVC though.

wzdev-ci commented 14 years ago

Per commented


I think we can remove this safety check and rather focus on eliminating floating point usage everywhere that affects game play.

wzdev-ci commented 14 years ago

Cyp commented


The i64Sqrt function does affect gameplay, and using the FPU and subtracting 1 if it happened to round up instead of down is probably the fastest way without a really really huge lookup table. So sqrt() and when generating the sin() tables are the two places where floating point that affects gameplay should actually remain.

wzdev-ci commented 14 years ago

Safety0ff uploaded file float.diff (21.3 KiB)

From http://www.christian-seiler.de/projekte/fpmath/

wzdev-ci commented 14 years ago

Safety0ff commented


That patch is a naive attempt at integrating the stuff in that link (link thanks to dak180.)

Things to do, check cross compilation. Add nice SSE switches.

wzdev-ci commented 14 years ago

Safety0ff commented


Other notes:

wzdev-ci commented 14 years ago

Safety0ff commented


32bit CC works for me, I think Buginator had mentioned it being a issue when you CC using a 64 bit system.

For 32bit I used the -msse2 -mfpmath=sse options, it only errors it gave where the mandelbrot tests.

When I cross compiled with the above patch the only errors I got were fptest1 and fptest2.

wzdev-ci commented 14 years ago

Buginator set resolution to fixed

wzdev-ci commented 14 years ago

Buginator commented


Cyp_ fixed this in [11121]

wzdev-ci commented 14 years ago

Buginator changed status from new to closed

wzdev-ci commented 12 years ago

cybersphinx changed milestone from 3.0 to unspecified

wzdev-ci commented 12 years ago

cybersphinx commented


Milestone 3.0 deleted