summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/20031102-1.c
blob: 5a02a704a26f7c6c9d2c0c829293bce2208023ef (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
/* PR optimization/12799 */
/* Origin: Pratap Subrahmanyam <pratap@vmware.com> */

/* { dg-do run } */
/* { dg-options "-O2" } */
/* { dg-options "-O2 -march=i686" { target { { i686-*-* x86_64-*-* } && ilp32 } } } */

/* Verify that reload_cse_move2add doesn't add unexpected CLOBBERs. */

extern void abort(void);

int loo = 1;

__inline__ char InlineFunc(void)
{
  return __builtin_expect(!!(loo == 1), 1);
}

int FooBar(void)
{
  int i;
  int var1 = InlineFunc() ? 2046 : 1023;
  int var2 = InlineFunc() ? 512 : 1024;

  for (i = 0; i < var1; i++)
    ;

  if (InlineFunc() && var2 != 512)
    abort();

  return 0;
}

int main(void)
{
  return FooBar();
}