fteqw icon indicating copy to clipboard operation
fteqw copied to clipboard

fteqcc with -Ovectorcalls segfaults on FrogBot source

Open DrLex0 opened this issue 1 year ago • 1 comments

I was trying to rebuild the FrogBot qwprogs.dat from source in Ubuntu, and it is essential to enable -Ovectorcalls to build this for a large number of maps. Without this option, the numpr_globals limit is exceeded and fteqcc switches to a format incompatible with engines like ezQuake.

The problem is that both the old fteqcc that can be installed in Ubuntu through APT, as well as recent source I downloaded and compiled from the https://www.fteqcc.org/ page, crash with a segfault 💥 when attempting to build FrogBot source by running fteqcc -O3 -Ovectorcalls. When I replace -O3 with -O0, it hangs at 100% CPU.
Maybe the FrogBot code does contain something fishy, but then it should exit with a helpful error instead of just going kaboom.

(Yes, FrogBot code is fishy and badly needs a rework to avoid having to recompile the whole thing just to add a map, with waypoint data consisting of QC code that adds about 200 globals per map, but this is what we're currently stuck with until someone dares to take a deep dive in the code.)

If you want to give it a shot, the FB source can be found here (via Mick's guide). I had to fix some #include paths to get it to build at all, but maybe that was only needed for the older version. Note that this source includes an old Windows build of fteqcc with explicit instructions to use that one because it won't crash.

DrLex0 avatar Dec 17 '24 23:12 DrLex0

This is no longer ‘urgent’ (insofar it ever was). When modifying the Frogbot code to pass the arguments to the N() function as 3 floats instead of a vector, adding a new map waypoint file results in way fewer new globals, probably the same effect as compiling the old code with -Ovectorcalls.

DrLex0 avatar Dec 23 '24 14:12 DrLex0