File tree Expand file tree Collapse file tree 4 files changed +32
-3
lines changed Expand file tree Collapse file tree 4 files changed +32
-3
lines changed Original file line number Diff line number Diff line change
1
+ #include <assert.h>
2
+
3
+ struct test
4
+ {
5
+ unsigned int a ;
6
+ unsigned int b ;
7
+ };
8
+
9
+ int main ()
10
+ {
11
+ struct test t ;
12
+ if (t .a > 10 )
13
+ assert (t .a > 0 );
14
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --trace --z3
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION SUCCESSFUL$
7
+ --
8
+ ^map::at:
9
+ key not found
10
+ --
11
+ This test checks the encoding of C `struct`s using SMT2 data types.
Original file line number Diff line number Diff line change @@ -4890,8 +4890,10 @@ void smt2_convt::find_symbols_rec(
4890
4890
4891
4891
if (recstack.find (id) == recstack.end ())
4892
4892
{
4893
+ const auto &base_struct = ns.follow_tag (struct_tag);
4893
4894
recstack.insert (id);
4894
- find_symbols_rec (ns.follow_tag (struct_tag), recstack);
4895
+ find_symbols_rec (base_struct, recstack);
4896
+ datatype_map[type] = datatype_map[base_struct];
4895
4897
}
4896
4898
}
4897
4899
else if (type.id () == ID_union_tag)
Original file line number Diff line number Diff line change @@ -209,8 +209,10 @@ class smt2_convt : public stack_decision_proceduret
209
209
210
210
identifier_mapt identifier_map;
211
211
212
- // for modeling structs as Z3 datatype, enabled when
213
- // use_datatype is set
212
+ // for modeling structs as SMT datatype when use_datatype is set
213
+ //
214
+ // it maintains a map of `struct_typet` or `struct_tag_typet`
215
+ // to datatype names declared in SMT
214
216
typedef std::map<typet, std::string> datatype_mapt;
215
217
datatype_mapt datatype_map;
216
218
You can’t perform that action at this time.
0 commit comments