GCC should probably warn about useless comparison.
e.g.
#include <stdlib.h>

extern int *bar (int *);

int * foo (int a, int *c, int *b) {
        int *ret = NULL;
        if (a)
          ret = c;
        else
          ret == bar (b);

        return ret;
}

-- 
           Summary: useless comparison warning
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: phython at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to