summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture/reassoc-1.c
blob: f0c9014cc6ea8b25df66c28109ec214cb74b8ab6 (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 run } */

int x;

int __attribute__((noinline))
foo(int a, int b, int w)
{
  int tmp1 = a * w;
  int tmp2 = b * w;
  x = tmp1;
  return tmp1 + tmp2;
}

extern void abort (void);

int main()
{
  if (foo(1, 2, 3) != 9)
    abort ();
  if (x != 3)
    abort ();
  return 0;
}