File tree Expand file tree Collapse file tree 26 files changed +430
-0
lines changed
Expand file tree Collapse file tree 26 files changed +430
-0
lines changed Original file line number Diff line number Diff line change 1+ #include <assert.h>
2+
3+ struct A
4+ {
5+ int x ;
6+ int y ;
7+ };
8+
9+ int main (int argc , char * * argv )
10+ {
11+ struct A a ;
12+ a .x = argc ;
13+ a .y = argc + 1 ;
14+ assert (a .x == argc );
15+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ test.c
3+ --show-vcc
4+ main::1::a!0@1#2\.\.x = main::argc!0@1#1
5+ main::1::a!0@1#2\.\.y = 1 \+ main::argc!0@1#1
6+ ^EXIT=0$
7+ ^SIGNAL=0$
8+ --
9+ main::1::a!\d+@\d+#\d+\.x
10+ main::1::a!\d+@\d+#\d+\.y
11+ --
12+ Fields A::x and A::y should be referred to as atomic symbols (a..x and a..y) but not using
13+ member operators (a.x and a.y).
Original file line number Diff line number Diff line change 1+ #include <assert.h>
2+
3+ struct A
4+ {
5+ int x ;
6+ int y ;
7+ int z ;
8+ };
9+
10+ int main (int argc , char * * argv )
11+ {
12+ struct A a1 , a2 ;
13+ char * field = (argc % 2 ? (char * )& a1 .y : (char * )& a2 .z ) + 1 ;
14+ * field = (char )argc ;
15+ assert (a1 .y == argc );
16+ assert (a2 .z == argc );
17+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ test.c
3+ --show-vcc
4+ main::1::a1!0@1#2\.\.y =
5+ main::1::a2!0@1#2\.\.z =
6+ ^EXIT=0$
7+ ^SIGNAL=0$
8+ --
9+ main::1::a[12]!\d+@\d+#\d+\.[xyz]
10+ --
11+ Fields A::y and A::z should be referred to as atomic symbols (a[12]..y and a[12]..z) but not using
12+ member operators (a[12].[xyz]).
13+ While the field is aliased with a different type, the typecast is successfully reduced to address just
14+ one field, rather than using a byte-update operation against the whole structure.
15+ This is like field-sensitivity8 except the pointer leads into the middle of a field.
Original file line number Diff line number Diff line change 1+ #include <assert.h>
2+
3+ struct A
4+ {
5+ int x ;
6+ int y ;
7+ };
8+
9+ int main (int argc , char * * argv )
10+ {
11+ struct A a1 , a2 ;
12+ a1 .x = argc ;
13+ a1 .y = argc + 1 ;
14+ a2 = a1 ;
15+ assert (a2 .x == argc );
16+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ test.c
3+ --show-vcc
4+ main::1::a1!0@1#2\.\.x = main::argc!0@1#1
5+ main::1::a1!0@1#2\.\.y = 1 \+ main::argc!0@1#1
6+ main::1::a2!0@1#2\.\.x = main::1::a1!0@1#2\.\.x
7+ main::1::a2!0@1#2\.\.y = main::1::a1!0@1#2\.\.y
8+ ^EXIT=0$
9+ ^SIGNAL=0$
10+ --
11+ main::1::a[12]!\d+@\d+#\d+\.[xy]
12+ --
13+ Fields A::x and A::y should be referred to as atomic symbols (a[12]..x and a[12]..y) but not using
14+ member operators (a[12].x and a[12].y).
15+ This test looks at the particular case of whole-struct assignment.
Original file line number Diff line number Diff line change 1+ #include <assert.h>
2+
3+ struct A
4+ {
5+ int x ;
6+ int y ;
7+ };
8+
9+ int main (int argc , char * * argv )
10+ {
11+ struct A a1 , a2 ;
12+ a1 .x = argc ;
13+ a1 .y = argc + 1 ;
14+ struct A * aptr = argc % 2 ? & a1 : & a2 ;
15+ * aptr = a1 ;
16+ assert (a2 .x == argc );
17+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ test.c
3+ --show-vcc
4+ main::1::a1!0@1#2\.\.x = main::argc!0@1#1
5+ main::1::a1!0@1#2\.\.y = 1 \+ main::argc!0@1#1
6+ main::1::a1!0@1#3\.\.x = main::1::a1!0@1#2\.\.x
7+ main::1::a1!0@1#3\.\.y = main::1::a1!0@1#2\.\.y
8+ main::1::a2!0@1#2\.\.x =
9+ main::1::a2!0@1#2\.\.y =
10+ ^EXIT=0$
11+ ^SIGNAL=0$
12+ --
13+ main::1::a[12]!\d+@\d+#\d+\.[xy]
14+ --
15+ Fields A::x and A::y should be referred to as atomic symbols (a[12]..x and a[12]..y) but not using
16+ member operators (a[12].x and a[12].y).
17+ This test looks at the particular case of whole-struct assignment when the target of the assignment
18+ is uncertain due to pointer indirection.
Original file line number Diff line number Diff line change 1+ #include <assert.h>
2+
3+ struct A
4+ {
5+ int x ;
6+ int y ;
7+ };
8+
9+ struct B
10+ {
11+ struct A a ;
12+ int z ;
13+ };
14+
15+ int main (int argc , char * * argv )
16+ {
17+ struct B b1 , b2 ;
18+ b1 .a .x = argc ;
19+ b1 .a .y = argc + 1 ;
20+ struct A * aptr = argc % 2 ? & b1 .a : & b2 .a ;
21+ * aptr = b1 .a ;
22+ assert (b2 .a .x == argc );
23+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ test.c
3+ --show-vcc
4+ main::1::b1!0@1#2\.\.a\.\.x = main::argc!0@1#1
5+ main::1::b1!0@1#2\.\.a\.\.y = 1 \+ main::argc!0@1#1
6+ main::1::b1!0@1#3\.\.a\.\.x = main::1::b1!0@1#2\.\.a\.\.x
7+ main::1::b1!0@1#3\.\.a\.\.y = main::1::b1!0@1#2\.\.a\.\.y
8+ main::1::b2!0@1#2\.\.a\.\.x =
9+ main::1::b2!0@1#2\.\.a\.\.y =
10+ ^EXIT=0$
11+ ^SIGNAL=0$
12+ --
13+ main::1::b[12]!\d+@\d+#\d+\.a
14+ --
15+ Fields A::x and A::y should be referred to as atomic symbols (b[12]..a..x and b[12]..a..y) but not using
16+ member operators (b[12].a.x and b[12].a.y).
17+ This test looks at the particular case of whole-struct assignment when the target of the assignment
18+ is uncertain due to pointer indirection.
You can’t perform that action at this time.
0 commit comments