Skip to content

Commit 4b8ac7c

Browse files
committed
Simplify away type cast
The array size may include a type cast, possibly of a constant. Therefore, the size would be found to be constant via simplification, but other ways of computing the size may fail to derive a constant.
1 parent 99c5a92 commit 4b8ac7c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/goto-programs/builtin_functions.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Author: Daniel Kroening, [email protected]
2222
#include <util/prefix.h>
2323
#include <util/rational.h>
2424
#include <util/rational_tools.h>
25+
#include <util/simplify_expr.h>
2526
#include <util/symbol_table.h>
2627

2728
#include <langapi/language_util.h>
@@ -699,7 +700,7 @@ void goto_convertt::do_havoc_slice(
699700
t->source_location_nonconst().set_comment(
700701
"assertion havoc_slice " + from_expr(ns, identifier, ok_expr));
701702

702-
const array_typet array_type(char_type(), arguments[1]);
703+
const array_typet array_type(char_type(), simplify_expr(arguments[1], ns));
703704

704705
const symbolt &nondet_contents =
705706
new_tmp_symbol(array_type, "nondet_contents", dest, source_location, mode);

0 commit comments

Comments
 (0)