re PR tree-optimization/33291 (a+=2; a+=2 not simplified to a+=4; with -O3 ...
[gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / 20040326-1.c
1 /* { dg-options "-O2 -fno-inline-functions" } */
2 /* { dg-do run } */
3 /* When there are no call-clobbered variables, we should still create
4 a .GLOBAL_VAR to model the side effects of functions. Without it,
5 we were moving the call to Faref() inside the second call to
6 Faset(). */
7 extern void abort (void);
8 extern void exit (int);
9
10 main ()
11 {
12 int table, c, elt;
13 int tem = Faref (table, elt);
14 Faset (table, elt, c);
15 Faset (table, c, tem);/* tem cannot be replaced with Faref (table, elt) */
16 exit (0);
17 }
18
19 int j = 0;
20
21 int __attribute__ ((noinline)) Faref (table, elt)
22 {
23 j = 1;
24 return 0;
25 }
26
27 int __attribute__ ((noinline)) Faset (table, elt, c)
28 {
29 if (j != 1)
30 abort ();
31 return 0;
32 }