Skip to content

Commit 7e30cdc

Browse files
Validate renamings before inserting in value set
I noticed writting unit tests, that the argument of this function should have been renamed to level 1 to get the expected result. It took some time to realize that fact by debugging and having a check early would have made it much faster.
1 parent 645f917 commit 7e30cdc

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/pointer-analysis/value_set.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Author: Daniel Kroening, [email protected]
2222

2323
#include <langapi/language_util.h>
2424
#include <util/range.h>
25+
#include <goto-symex/renamed.h>
2526

2627
#ifdef DEBUG
2728
#include <iostream>
@@ -1220,7 +1221,8 @@ void value_sett::assign(
12201221
std::cout << "--------------------------------------------\n";
12211222
output(ns, std::cout);
12221223
#endif
1223-
1224+
PRECONDITION(is_l1_renamed(lhs));
1225+
PRECONDITION(is_l1_renamed(rhs));
12241226
const typet &type=ns.follow(lhs.type());
12251227

12261228
if(type.id()==ID_struct ||

src/pointer-analysis/value_set.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,8 @@ class value_sett
374374

375375
/// Transforms this value-set by executing executing the assignment
376376
/// `lhs := rhs` against it.
377-
/// \param lhs: written expression
378-
/// \param rhs: read expression
377+
/// \param lhs: written expression, renamed to level 1
378+
/// \param rhs: read expression, renamed to level 1
379379
/// \param ns: global namespace
380380
/// \param is_simplified: if false, `simplify` will be used to simplify
381381
/// RHS and LHS before execution. If you know they are already simplified,

0 commit comments

Comments
 (0)