view gcc/testsuite/gcc.dg/strcmpopt_3.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children 1830386684a0
line wrap: on
line source

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

__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 "strlen" } } */