re PR tree-optimization/33291 (a+=2; a+=2 not simplified to a+=4; with -O3 ...
[gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / 20050719-1.c
1 /* { dg-do run } */
2 /* { dg-options "-O2" } */
3
4 extern void abort (void) __attribute__ ((__nothrow__)) __attribute__
5 ((__noreturn__));
6 extern void exit (int __status) __attribute__ ((__nothrow__))
7 __attribute__ ((__noreturn__));
8
9 struct bootLoader {
10 int x;
11 };
12
13 void
14 zap(struct bootLoader *bootLoader)
15 {
16 /* The expression on the RHS of the assignment is *not* a
17 dereference of pointer 'bootLoader'. It is merely used as an
18 offset calculation. VRP was erroneously removing the if()
19 because it thought that 'bootLoader' was always dereferenced. */
20 int *boot = &bootLoader->x;
21
22 if (bootLoader)
23 {
24 useboot (boot);
25 }
26 }
27
28 int
29 useboot (void *boot)
30 {
31 abort ();
32 }
33
34 main()
35 {
36 zap (0);
37 return 0;
38 }