Trial fix for F9 / OpenSuSE / gcc 4.3 make check failure (ticket:258)

Revision 9296 contains a a trial fix for the make check
problem we’ve been seeing with gcc 4.3 (F9 and OpenSuSE), ticket:258.

The problem is that we were using a signed integer for a fixed point
accumulator which we were counting on overflowing.

According to the fine print in the C and C++ standards, if a signed
integer type overflows, the result is undefined. As of gcc 4.3, gcc
was proving that our code was overflowing, and took advantage of the
“undefined” result to short circuit the evaluation.

Moral of the story: if you’re using a fixed point phase accumulator,
or anything else where you’re counting on overflow happening, be sure
that your variable is unsigned.

See also http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37067 and
Airs – Ian Lance Taylor » Signed Overflow

Thanks to Stefan Bruens and Philip Ballister for working on this.

Eric

On Thu, Aug 14, 2008 at 9:20 PM, Eric B. [email protected] wrote:

Moral of the story: if you’re using a fixed point phase accumulator,
or anything else where you’re counting on overflow happening, be sure
that your variable is unsigned.

See also 37067 – gcc creating wrong code with -O2 and
http://www.airs.com/blog/archives/120

Thanks to Stefan Bruens and Philip Ballister for working on this.

I just built GNU Radio trunk on Fedora 9 and make check ran until the
end. No obvious failures. This is an improvement over earlier
revisions.

Philip

On Thu, Aug 14, 2008 at 10:27:35PM -0400, Philip B. wrote:

Philip

Thanks Philip!

Eric