@@ -145,11 +145,8 @@ void arrayst::collect_arrays(const exprt &a)
145145 collect_arrays (with_expr.old ());
146146
147147 // make sure this shows as an application
148- for (std::size_t i = 1 ; i < with_expr.operands ().size (); i += 2 )
149- {
150- index_exprt index_expr (with_expr.old (), with_expr.operands ()[i]);
151- record_array_index (index_expr);
152- }
148+ index_exprt index_expr (with_expr.old (), with_expr.where ());
149+ record_array_index (index_expr);
153150 }
154151 else if (a.id ()==ID_update)
155152 {
@@ -574,31 +571,24 @@ void arrayst::add_array_constraints_with(
574571 const index_sett &index_set,
575572 const with_exprt &expr)
576573{
577- // We got x=(y with [i:=v, j:=w, ... ]).
578- // First add constraints x[i]=v, x[j]=w, ...
574+ // We got x=(y with [i:=v]).
575+ // First add constraint x[i]=v
579576 std::unordered_set<exprt, irep_hash> updated_indices;
580577
581- const exprt::operandst &operands = expr.operands ();
582- for (std::size_t i = 1 ; i + 1 < operands.size (); i += 2 )
583- {
584- const exprt &index = operands[i];
585- const exprt &value = operands[i + 1 ];
586-
587- index_exprt index_expr (
588- expr, index, to_array_type (expr.type ()).element_type ());
578+ index_exprt index_expr (
579+ expr, expr.where (), to_array_type (expr.type ()).element_type ());
589580
590- DATA_INVARIANT_WITH_DIAGNOSTICS (
591- index_expr.type () == value .type (),
592- " with-expression operand should match array element type" ,
593- irep_pretty_diagnosticst{expr});
581+ DATA_INVARIANT_WITH_DIAGNOSTICS (
582+ index_expr.type () == expr. new_value () .type (),
583+ " with-expression operand should match array element type" ,
584+ irep_pretty_diagnosticst{expr});
594585
595- lazy_constraintt lazy (
596- lazy_typet::ARRAY_WITH, equal_exprt (index_expr, value ));
597- add_array_constraint (lazy, false ); // added immediately
598- array_constraint_count[constraint_typet::ARRAY_WITH]++;
586+ lazy_constraintt lazy (
587+ lazy_typet::ARRAY_WITH, equal_exprt (index_expr, expr. new_value () ));
588+ add_array_constraint (lazy, false ); // added immediately
589+ array_constraint_count[constraint_typet::ARRAY_WITH]++;
599590
600- updated_indices.insert (index);
601- }
591+ updated_indices.insert (expr.where ());
602592
603593 // For all other indices use the existing value, i.e., add constraints
604594 // x[I]=y[I] for I!=i,j,...
0 commit comments