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