Skip to content

Commit 1f06cde

Browse files
author
Daniel Kroening
authored
Merge pull request diffblue#2743 from tautschnig/boolbv-width
Fix boolbv_widtht::get_entry and fail for unknown types
2 parents 4e95060 + d33628e commit 1f06cde

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

regression/cbmc/struct10/main.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#include <assert.h>
2+
3+
struct S
4+
{
5+
int x;
6+
};
7+
8+
struct T
9+
{
10+
struct S a[2];
11+
};
12+
13+
int main()
14+
{
15+
struct T t;
16+
t.a[1].x = 42;
17+
assert(t.a[1].x == 42);
18+
return 0;
19+
}

regression/cbmc/struct10/test.desc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
8+
^warning: ignoring

src/solvers/flattening/boolbv_width.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ const boolbv_widtht::entryt &boolbv_widtht::get_entry(const typet &type) const
195195
}
196196
else if(type_id==ID_pointer)
197197
entry.total_width = type_checked_cast<pointer_typet>(type).get_width();
198-
else if(type_id==ID_symbol)
198+
else if(type_id == ID_symbol_type)
199199
entry=get_entry(ns.follow(type));
200200
else if(type_id==ID_struct_tag)
201201
entry=get_entry(ns.follow_tag(to_struct_tag_type(type)));
@@ -209,6 +209,8 @@ const boolbv_widtht::entryt &boolbv_widtht::get_entry(const typet &type) const
209209
}
210210
else if(type_id==ID_string)
211211
entry.total_width=32;
212+
else if(type_id != ID_empty)
213+
UNIMPLEMENTED;
212214

213215
return entry;
214216
}

0 commit comments

Comments
 (0)