summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-prof/bb-reorg.c
blob: f850c9bfd1e144b3834a88556facd896bd3be13e (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
32
33
34
35
36
37
38
39
/* { dg-require-effective-target freorder } */
/* { dg-options "-O2 -freorder-blocks-and-partition" } */

#include <string.h>

#define SIZE 1000
int t0 = 0;
const char *t2[SIZE];
char buf[SIZE];

void
foo (void)
{
  char *s = buf;
  t0 = 1;

  for (;;)
    {
      if (*s == '\0')
	break;
      else
	{
	  t2[t0] = s;
	  t0++;
	}
      *s++ = '\0';
    }
  t2[t0] = NULL;
}


int
main ()
{
  strcpy (buf, "hello");
  foo ();
  return 0; 
}