summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/pr64317.c
blob: 32969fc689acb3de9b4a63f37f04c1862de6f472 (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
/* { dg-do compile { target { *-*-linux* && ia32 } } } */
/* { dg-options "-O2 -fpie" } */
/* { dg-final { scan-assembler "addl\[ \\t\]+\[$\]_GLOBAL_OFFSET_TABLE_, %ebx" } } */
/* { dg-final { scan-assembler "movl\[ \\t\]+c@GOTOFF\[(\]%ebx\[)\]" } } */
/* { dg-final { scan-assembler-not "movl\[ \\t\]+\[0-9]+\[(\]%esp\[)\], %ebx" } } */
long c;

int bar();

int foo (unsigned int iters)
{
  unsigned int i;
  
  int res = 0;
  static long t1;
  
  for (i = 0; i < iters; i++)
    {
      res = bar();
      t1 = c + res;
    }
  
  return t1 + res;
}