aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/pr81388-1.c
blob: 0beb5109d403ba53a5cf556e80f49208add106e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* { dg-do compile } */
/* { dg-options "-O2 -fno-strict-overflow -fdump-tree-tailc-details" } */

void bar();
void foo(char *dst)
{
  char *const end = dst;
  do {
    bar();
    dst += 2;
  } while (dst < end);
}

/* The loop only iterates once because pointer overflow always has undefined
   semantics.  As a result, call to bar becomes tail call.  */
/* { dg-final { scan-tree-dump-times "Found tail call " 1 "tailc" } } */