summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-10.c
blob: 091703a1017b28fda3783d530cfd93402ef1f73b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-fab" } */

/* 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.  */

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