For the small testcase below gcc-4.4.3 neither warns about the initialization
of var1 nor about the comparison against an integer. Nevertheless the
comparison
is optimized away.

// gcc -O2 -Wtype-limits
_Bool var1 = 3;
int test(void)
{
  if (var1 == 3)
    return 1;
  return 0;
}

This maybe related to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34455


-- 
           Summary: -Wtype-limits fails to warn for _Bool comparisons
           Product: gcc
           Version: 4.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sirl at gcc dot gnu dot org
 GCC build triplet: i686-redhat-linux
  GCC host triplet: i686-redhat-linux
GCC target triplet: i686-redhat-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44077

Reply via email to