aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/arm/pr42093.c
blob: 7ba2f933eef81272f3c5f6d09ad36d397ac7df81 (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
40
41
42
43
44
45
46
47
48
49
50
51
/* { dg-options "-mthumb -O2 -fno-reorder-blocks" }  */
/* { dg-require-effective-target arm_thumb2_ok } */
/* { dg-final { scan-assembler-not "tbb" } } */
/* { dg-final { scan-assembler-not "tbh" } } */

#include <stdlib.h>

int gbl;
int foo (int *buf, int n)
{
  int ctr = 0;
  int c;
  while (1)
    {
      c = buf[ctr++];
      switch (c)
        {
        case '\n':
          gbl++;
          break;

        case ' ': case '\t' : case '\f' : case '\r':
          break;

        case ';':
          do
            c = buf [ctr++];
          while (c != '\n' && c != -1);
          gbl++;
          break;

        case '/':
          {
            int prevc;
            c = buf [ctr++];
            if (c != '*')
              abort ();

            prevc = 0;
            while ((c = buf[ctr++]) && c != -1)
              {
                if (c == '\n')
                  gbl++;
              }
            break;
          }
        default:
          return c;
        }
    }
}