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

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Testcase that shows this isn't just about cmpq, but also cmpl and cmpw on
x86_64:

extern int strcmp (const char *, const char *);
extern void abort (void);

__attribute__((noipa, noinline, noclone)) void
foo (char *p)
{
  *p = '\0';
}

__attribute__((noipa, noinline, noclone)) int
bar (void)
{
  char b[16];
  foo (b);
  return strcmp (b, "abcdefg") != 0;
}

__attribute__((noipa, noinline, noclone)) int
baz (void)
{
  char b[16];
  foo (b);
  return strcmp (b, "abc") != 0;
}

__attribute__((noipa, noinline, noclone)) int
qux (void)
{
  char b[16];
  foo (b);
  return strcmp (b, "a") != 0;
}

int
main ()
{
  if (bar () != 1 || baz () != 1 || qux () != 1)
    abort ();
  return 0;
}

Reply via email to