File tree 3 files changed +12
-4
lines changed
regression/cbmc/Struct_Initialization1
3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 3
3
struct tag1 {
4
4
int f ;
5
5
int : 32 ; // unnamed bit-field, ignored during initialization
6
- int g ;
6
+ union {
7
+ int g ;
8
+ }; // anonymous, but not ignored
7
9
int * p ;
8
10
int a [2 ];
9
11
} x ;
Original file line number Diff line number Diff line change 1
- KNOWNBUG
1
+ CORE
2
2
main.c
3
3
4
4
^EXIT=0$
Original file line number Diff line number Diff line change @@ -665,10 +665,16 @@ void c_typecheck_baset::increment_designator(designatort &designator)
665
665
assert (components.size ()==entry.size );
666
666
667
667
// we skip over any padding or code
668
- while (entry.index <entry.size &&
668
+ // we also skip over anonymous members
669
+ while (entry.index < entry.size &&
669
670
(components[entry.index ].get_is_padding () ||
670
- components[entry.index ].type ().id ()==ID_code))
671
+ (components[entry.index ].get_anonymous () &&
672
+ components[entry.index ].type ().id () != ID_struct_tag &&
673
+ components[entry.index ].type ().id () != ID_union_tag) ||
674
+ components[entry.index ].type ().id () == ID_code))
675
+ {
671
676
entry.index ++;
677
+ }
672
678
673
679
if (entry.index <entry.size )
674
680
entry.subtype =components[entry.index ].type ();
You can’t perform that action at this time.
0 commit comments