[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] Solved (was Re: Optimisation bug in gcc 4 ?)



Le Wed, 9 Jun 2010 19:48:27 +0200
Patrice Mandin <mandin.patrice@orange.fr> a écrit:

> Hello,
> 
> I just encountered a strange optimisation bug with gcc 4 (4.4.2 more
> precisely), I hope it's fixed with 4.5.
> 
> Source is attached, this is a small test case.

I just found the bug in the code. Missing parenthesis for the test,
which makes it always true:

Buggy:
if ((vidx_cap.flags & (FLAG_UPSCALER|FLAG_DOWNSCALER)) != FLAG_UPSCALER|FLAG_DOWNSCALER) {

Fixed:
if ((vidx_cap.flags & (FLAG_UPSCALER|FLAG_DOWNSCALER)) != (FLAG_UPSCALER|FLAG_DOWNSCALER)) {

Just adding -Wall in compilation flags spitted the warning about
missing ( and ), it's ok now.

-- 
Patrice Mandin
WWW: http://pmandin.atari.org/
Programmeur Linux, Atari
Spécialité: Développement, jeux

"who writes the code, decides"