view gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-10.c @ 158:494b0b89df80 default tip

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

/* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-fab1" } */

/* Check that we fold strlen of equally long strings, and that we do not
   fail to terminate when there is a nontrivial cycle in the corresponding
   ssa graph.  */

extern __SIZE_TYPE__ strlen (const char *);
extern void bar (__SIZE_TYPE__);
extern int bla (void);

void foo(int i)
{
  char *s = "abcde";

  if (i)
    {
      s = "defgh";
      goto middle;
    }

start:

  bla ();

middle:

  if (bla ())
    goto start;

  bar (strlen (s));
}

/* There should be no calls to strlen.  */
/* { dg-final { scan-tree-dump-times "strlen" 0 "fab1"} } */