view gcc/testsuite/gcc.dg/strcmpopt_3.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
line wrap: on
line source

/* { dg-do run } */
/* { dg-options "-O2 -fdump-tree-optimized" } */

__attribute__ ((noinline)) int
f1 (void)
{
  char *s0= "abcd";
  char s[8];
  __builtin_strcpy (s, s0);
  return __builtin_strcmp (s, "abc") != 0;
}

__attribute__ ((noinline)) int
f2 (void)
{
  char *s0 = "ab";
  char s[8];
  __builtin_strcpy (s, s0);
  return __builtin_strcmp ("abc", s) != 0;
}

int main (void)
{
  if (f1 () != 1
      || f2 () != 1)
    __builtin_abort ();

  return 0;
}

/* { dg-final { scan-tree-dump-times "strcmp" 0 "optimized" } } */