Skip to content

Commit

Permalink
Fix handling of non-Data expressions as primitive arguments
Browse files Browse the repository at this point in the history
When adding support for returning lvalues in the expression evaluation
engine (#839), we
introduced support for using expressions which do not evaluate to a
simple Data value as primitive arguments. In particular, we can use an
expression which evaluates to a Header object as a primitive
argument. However, the code responsible for parsing the bmv2 input JSON
and instantiating Action objects was treating all expressions used as
primitive arguments as "Data expressions", thus causing bmv2 to crash
when it was actually not the case.

Fixes #887
  • Loading branch information
antoninbas committed May 10, 2020
1 parent 0a69227 commit c13e900
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/bm_sim/P4Objects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ P4Objects::process_single_param(ActionFn* action_fn,
build_expression(cfg_parameter["value"], expr, &expr_type);
expr->build();
action_fn->parameter_push_back_expression(
std::unique_ptr<Expression>(expr));
std::unique_ptr<Expression>(expr), expr_type);
} else if (type == "register") {
// TODO(antonin): cheap optimization
// this may not be worth doing, and probably does not belong here
Expand Down

0 comments on commit c13e900

Please sign in to comment.