Use -Wlogical-op on gcc 4.5 or higher It exposed one bug for us (see 8c3452bcb294e07888), and might prevent more.