summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/20020616-1.c
blob: 5641826b4837c281fd419b8749bcd909e3085820 (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
/* PR opt/6722 */
/* { dg-do run } */
/* { dg-options "-O2" } */

#if !__PIC__
register int k asm("%ebx");
#elif __amd64
register int k asm("%r12");
#else
register int k asm("%esi");
#endif

void __attribute__((noinline))
foo()
{
  k = 1;
}

void test()
{
  int i;
  for (i = 0; i < 10; i += k)
    {
      k = 0;
      foo();
    }
}

int main()
{
  int old = k;
  test();
  k = old;
  return 0;
}