[theora-dev] libtheora is a victim of GCC bug (PR34130)
Alexander E. Patrakov
patrakov at gmail.com
Wed Nov 21 03:02:23 PST 2007
(please CC: me on replies, I am not subscribed)
I have found a topic about gcc misoptimizing a * abs(b) to abs(a * b)
when a is a negative integer constant:
http://lkml.org/lkml/2007/11/19/493, more information at
http://gcc.gnu.org/PR34130. In response to this, I have patched my gcc
with the official fix, and added a warning that fires when gcc sees
negative_constant * abs(something), i.e., exactly the condition where
unpatched gcc miscompiles the program. Libtheora-1.0beta2 has
triggered this warning in lib/enc/pp.c, lines 363 and 383.
In other words, due to a bug in all released versions of gcc 3.x and
4.x, weak deringing works incorrectly. I suggest adding a workaround
to libtheora, because there is no released version of gcc without this
bug.
Possible workarounds:
1) add a configure test for this bug, compile with -fno-builtin if it fails.
2) make abs(x) a macro.
--
Alexander E. Patrakov
More information about the theora-dev
mailing list