comparison libmudflap/testsuite/libmudflap.c/pass53-frag.c @ 0:a06113de4d67

first commit
author kent <kent@cr.ie.u-ryukyu.ac.jp>
date Fri, 17 Jul 2009 14:47:48 +0900
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:a06113de4d67
1 int foo1 ()
2 {
3 union { int l; char c[sizeof (int)]; } k1;
4 char *m;
5 k1.l = 0;
6 /* This test variant triggers ADDR_EXPR of k explicitly in order to
7 ensure it's registered with the runtime. */
8 m = k1.c;
9 k1.c [sizeof (int)-1] = m[sizeof (int)-2];
10 }
11
12 int foo2 ()
13 {
14 union { int l; char c[sizeof (int)]; } k2;
15 k2.l = 0;
16 /* Since this access is known-in-range, k need not be registered
17 with the runtime, but then this access better not be instrumented
18 either. */
19 k2.c [sizeof (int)-1] ++;
20 return k2.l;
21 }
22
23 int foo3idx = sizeof (int)-1;
24
25 int foo3 ()
26 {
27 union { int l; char c[sizeof (int)]; } k3;
28 k3.l = 0;
29 /* NB this test uses foo3idx, an extern variable, to defeat mudflap
30 known-in-range-index optimizations. */
31 k3.c [foo3idx] ++;
32 return k3.l;
33 }
34
35 int main ()
36 {
37 foo1 ();
38 foo2 ();
39 foo3 ();
40 return 0;
41 }