[Bug c/65452] strcmp (foo, foo) could give a warning

mpolacek at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Oct 25 15:46:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65452

--- Comment #10 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
And another

#include <string.h>

struct S {
   int val;
};

int
f (struct S *sym1, struct S *sym2 __attribute__((unused)))
{
  return memcmp (&sym1->val, &sym1->val, sizeof (sym1->val));
}

#define N 0
#define M 0

int
f2 (void)
{
  extern const char *a[];
  return __builtin_strcmp (a[N], a[M]);
}


More information about the Gcc-bugs mailing list