Debian Codegraph @

gcc/testsuite/gcc.c-torture/execute/20041019-1.c

raw
1 /* { dg-additional-options "-fpermissive" } */
2
3 test_store_ccp (int i)
4 {
5 int *p, a, b, c;
6
7 if (i < 5)
8 p = &a;
9 else if (i > 8)
10 p = &b;
11 else
12 p = &c;
13
14 *p = 10;
15 b = 3;
16
17 /* STORE-CCP was wrongfully propagating 10 into *p. */
18 return *p + 2;
19 }
20
21
22 test_store_copy_prop (int i)
23 {
24 int *p, a, b, c;
25
26 if (i < 5)
27 p = &a;
28 else if (i > 8)
29 p = &b;
30 else
31 p = &c;
32
33 *p = i;
34 b = i + 1;
35
36 /* STORE-COPY-PROP was wrongfully propagating i into *p. */
37 return *p;
38 }
39
40
41 main()
42 {
43 int x;
44
45 x = test_store_ccp (10);
46 if (x == 12)
47 abort ();
48
49 x = test_store_copy_prop (9);
50 if (x == 9)
51 abort ();
52
53 return 0;
54 }