File tree Expand file tree Collapse file tree 3 files changed +53
-2
lines changed Expand file tree Collapse file tree 3 files changed +53
-2
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,11 @@ bvt boolbvt::conversion_failed(const exprt &expr)
152152 return prop.new_variables (width);
153153}
154154
155+ // / TODO
156+ // / \param expr: TODO
157+ // / \return TODO
158+ // / \throws bitvector_conversion_exceptiont raised if converting byte_extraction
159+ // / goes wrong. TODO: extend for other types of conversion exception).
155160bvt boolbvt::convert_bitvector (const exprt &expr)
156161{
157162 if (expr.type ().id ()==ID_bool)
Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ Author: Daniel Kroening, kroening@kroening.com
1616#include < util/endianness_map.h>
1717
1818#include " flatten_byte_operators.h"
19+ #include " flatten_byte_extract_exceptions.h"
20+ #include " bv_conversion_exceptions.h"
1921
2022bvt map_bv (const endianness_mapt &map, const bvt &src)
2123{
@@ -42,8 +44,16 @@ bvt boolbvt::convert_byte_extract(const byte_extract_exprt &expr)
4244 // if we extract from an unbounded array, call the flattening code
4345 if (is_unbounded_array (expr.op ().type ()))
4446 {
45- exprt tmp=flatten_byte_extract (expr, ns);
46- return convert_bv (tmp);
47+ try
48+ {
49+ exprt tmp = flatten_byte_extract (expr, ns);
50+ return convert_bv (tmp);
51+ }
52+ catch (const flatten_byte_extract_exceptiont &byte_extract_flatten_exception)
53+ {
54+ std::throw_with_nested (
55+ bitvector_conversion_exceptiont (" Can't convert byte_extraction" , expr));
56+ }
4757 }
4858
4959 std::size_t width=boolbv_width (expr.type ());
Original file line number Diff line number Diff line change 1+ /* ******************************************************************\
2+
3+ Module: Bit vector conversion
4+
5+ Author: Diffblue Ltd.
6+
7+ \*******************************************************************/
8+
9+ // / \file
10+ // / Exceptions that can be raised in bv_conversion
11+
12+ #ifndef CPROVER_SOLVERS_FLATTENING_BV_CONVERSION_EXCEPTIONS_H
13+ #define CPROVER_SOLVERS_FLATTENING_BV_CONVERSION_EXCEPTIONS_H
14+
15+ #include " flatten_byte_extract_exceptions.h"
16+ #include " flatten_byte_operators.h"
17+ #include < util/endianness_map.h>
18+ #include < util/arith_tools.h>
19+ #include " boolbv.h"
20+ #include " bv_conversion_exceptions.h"
21+
22+ class bitvector_conversion_exceptiont : public std ::runtime_error
23+ {
24+ public:
25+ bitvector_conversion_exceptiont (
26+ const std::string &exception_message,
27+ const exprt &bv_expr)
28+ : runtime_error(exception_message), bv_expr(bv_expr)
29+ {
30+ }
31+
32+ private:
33+ exprt bv_expr;
34+ };
35+
36+ #endif // CPROVER_SOLVERS_FLATTENING_BV_CONVERSION_EXCEPTIONS_H
You can’t perform that action at this time.
0 commit comments