view gcc/testsuite/c-c++-common/pr34029-1.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
line wrap: on
line source

static const char s[] = "ab.cd.efghijk";

int
foo (const char *x)
{
  const char *a;
  int b = 0;

  a = __builtin_strchr (s, '.');
  if (a == 0)
    b = 1;
  else if ((a = __builtin_strchr (a + 1, '.')) == 0)
    b = 1;
  else if (__builtin_strncmp (s, x, a - s))
    b = 1;
  else if (__builtin_strncmp (a + 1, x + (a - s + 1), 4) < 0)
    b = 1;

  if (b)
    return 4;
  return 0;
}