Skip to content

Commit e5349cc

Browse files
Petr BauchPetr Bauch
Petr Bauch
authored and
Petr Bauch
committed
Small fixes based on comments
This commit will likely be squashed.
1 parent 83fb9f0 commit e5349cc

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

src/goto-programs/goto_functions.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,6 @@ class goto_functionst
115115
function_map[fun.first].copy_from(fun.second);
116116
}
117117

118-
/// Check that the goto functions are well-formed
119-
///
120-
/// The validation mode indicates whether well-formedness check failures are
121-
/// reported via DATA_INVARIANT violations or exceptions.
122-
void validate(const namespacet &ns, const validation_modet vm) const
123-
{
124-
for(const auto &entry : function_map)
125-
{
126-
const goto_functiont &goto_function = entry.second;
127-
goto_function.validate(ns, vm);
128-
}
129-
}
130-
131118
std::vector<function_mapt::const_iterator> sorted() const;
132119
std::vector<function_mapt::iterator> sorted();
133120

src/goto-symex/symex_target_equation.cpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Author: Daniel Kroening, [email protected]
1111

1212
#include "symex_target_equation.h"
1313

14+
#include <util/base_type.h>
1415
#include <util/format_expr.h>
1516
#include <util/std_expr.h>
1617
#include <util/throw_with_nested.h>
@@ -977,6 +978,9 @@ void symex_target_equationt::SSA_stept::output(std::ostream &out) const
977978
out << "Guard: " << format(guard) << '\n';
978979
}
979980

981+
/// Check that the SSA step is well-formed
982+
/// \param ns namespace to lookup identifiers
983+
/// \param vm validation mode to be used for reporting failures
980984
void symex_target_equationt::SSA_stept::validate(
981985
const namespacet &ns,
982986
const validation_modet vm) const
@@ -997,27 +1001,32 @@ void symex_target_equationt::SSA_stept::validate(
9971001
validate_expr_full_pick(ssa_full_lhs, ns, vm);
9981002
validate_expr_full_pick(original_full_lhs, ns, vm);
9991003
validate_expr_full_pick(ssa_rhs, ns, vm);
1004+
base_type_eq(ssa_lhs.get_original_expr(), ssa_rhs, ns);
10001005
break;
10011006
case goto_trace_stept::typet::INPUT:
10021007
case goto_trace_stept::typet::OUTPUT:
10031008
for(const auto &expr : io_args)
10041009
validate_expr_full_pick(expr, ns, vm);
1005-
for(const auto &expr : converted_io_args)
1006-
validate_expr_full_pick(expr, ns, vm);
10071010
break;
10081011
case goto_trace_stept::typet::FUNCTION_CALL:
10091012
for(const auto &expr : ssa_function_arguments)
10101013
validate_expr_full_pick(expr, ns, vm);
1011-
for(const auto &expr : converted_function_arguments)
1012-
validate_expr_full_pick(expr, ns, vm);
10131014
case goto_trace_stept::typet::FUNCTION_RETURN:
10141015
{
10151016
const symbolt *symbol;
10161017
DATA_CHECK(
10171018
!ns.lookup(function_identifier, symbol), "unknown function identifier");
10181019
}
10191020
break;
1020-
default:
1021+
case goto_trace_stept::typet::NONE:
1022+
case goto_trace_stept::typet::LOCATION:
1023+
case goto_trace_stept::typet::DEAD:
1024+
case goto_trace_stept::typet::SHARED_READ:
1025+
case goto_trace_stept::typet::SHARED_WRITE:
1026+
case goto_trace_stept::typet::SPAWN:
1027+
case goto_trace_stept::typet::MEMORY_BARRIER:
1028+
case goto_trace_stept::typet::ATOMIC_BEGIN:
1029+
case goto_trace_stept::typet::ATOMIC_END:
10211030
break;
10221031
}
10231032
}

src/util/ssa_expr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class ssa_exprt:public symbol_exprt
142142

143143
void check(const validation_modet vm = validation_modet::INVARIANT) const
144144
{
145-
DATA_CHECK(!has_operands(), "SSA expression do not have operands");
145+
DATA_CHECK(!has_operands(), "SSA expression should not have operands");
146146
DATA_CHECK(id() == ID_symbol, "SSA expression symbols are symbols");
147147
DATA_CHECK(get_bool(ID_C_SSA_symbol), "wrong SSA expression ID");
148148
}

src/util/validate_expressions.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Author: Daniel Poetzl
1414

1515
#include "expr.h"
1616
#include "namespace.h"
17-
#include "std_expr.h"
17+
#include "ssa_expr.h"
1818
#include "validate.h"
1919

2020
#define CALL_ON_EXPR(expr_type) \
@@ -31,6 +31,10 @@ void call_on_expr(const exprt &expr, Args &&... args)
3131
{
3232
CALL_ON_EXPR(plus_exprt);
3333
}
34+
else if(expr.get_bool(ID_C_SSA_symbol))
35+
{
36+
CALL_ON_EXPR(ssa_exprt);
37+
}
3438
else
3539
{
3640
#ifdef REPORT_UNIMPLEMENTED_EXPRESSION_CHECKS

0 commit comments

Comments
 (0)