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

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Same here (Clang doesn't eliminate the test here though):

void f (void)
{
  void *p = __builtin_malloc (sizeof (void*));

  if (p == f)   // not folded
    __builtin_abort ();
}

Here, GCC eliminates the equality test with a but not the one with b (Clang
eliminates neither):

char a[8] = "";
char b[8];

void f (void)
{
  void *p = __builtin_malloc (sizeof (void*));

  if (p == a)   // folded to false
    __builtin_abort ();
}

void g (void)
{
  void *p = __builtin_malloc (sizeof (void*));

  if (p == b)   // not folded
    __builtin_abort ();
}

Reply via email to