@@ -132,6 +132,86 @@ exprt adjust_lhs_object(
132
132
133
133
/* ******************************************************************\
134
134
135
+ Function: set_internal_dynamic_object
136
+
137
+ Inputs:
138
+
139
+ Outputs:
140
+
141
+ Purpose: set internal field for variable assignment related to
142
+ dynamic_object[0-9] and dynamic_[0-9]_array.
143
+
144
+ \*******************************************************************/
145
+
146
+ void set_internal_dynamic_object (
147
+ const exprt &expr,
148
+ goto_trace_stept &goto_trace_step,
149
+ const namespacet &ns)
150
+ {
151
+ if (expr.id ()==ID_symbol)
152
+ {
153
+ const irep_idt &id=to_ssa_expr (expr).get_original_name ();
154
+ const symbolt *symbol;
155
+ if (!ns.lookup (id, symbol))
156
+ {
157
+ bool result=symbol->type .get_bool (" #dynamic" );
158
+ if (result)
159
+ goto_trace_step.internal =true ;
160
+ }
161
+ }
162
+ else
163
+ {
164
+ forall_operands (it, expr)
165
+ set_internal_dynamic_object (*it, goto_trace_step, ns);
166
+ }
167
+ }
168
+
169
+ /* ******************************************************************\
170
+
171
+ Function: update_internal_field
172
+
173
+ Inputs:
174
+
175
+ Outputs:
176
+
177
+ Purpose: set internal for variables assignments related to
178
+ dynamic_object and CPROVER internal functions
179
+ (e.g., __CPROVER_initialize)
180
+
181
+ \*******************************************************************/
182
+
183
+ void update_internal_field (
184
+ const symex_target_equationt::SSA_stept &SSA_step,
185
+ goto_trace_stept &goto_trace_step,
186
+ const namespacet &ns)
187
+ {
188
+ // set internal for dynamic_object in both lhs and rhs expressions
189
+ set_internal_dynamic_object (SSA_step.ssa_lhs , goto_trace_step, ns);
190
+ set_internal_dynamic_object (SSA_step.ssa_rhs , goto_trace_step, ns);
191
+
192
+ // set internal field to CPROVER functions (e.g., __CPROVER_initialize)
193
+ if (SSA_step.is_function_call ())
194
+ {
195
+ if (SSA_step.source .pc ->source_location .as_string ().empty ())
196
+ goto_trace_step.internal =true ;
197
+ }
198
+
199
+ // set internal field to input and output steps
200
+ if (goto_trace_step.type ==goto_trace_stept::OUTPUT ||
201
+ goto_trace_step.type ==goto_trace_stept::INPUT)
202
+ {
203
+ goto_trace_step.internal =true ;
204
+ }
205
+
206
+ // set internal field to _start function-return step
207
+ if (SSA_step.source .pc ->function ==goto_functionst::entry_point ())
208
+ {
209
+ goto_trace_step.internal =true ;
210
+ }
211
+ }
212
+
213
+ /* ******************************************************************\
214
+
135
215
Function: build_goto_trace
136
216
137
217
Inputs:
@@ -237,6 +317,9 @@ void build_goto_trace(
237
317
goto_trace_step.formatted =SSA_step.formatted ;
238
318
goto_trace_step.identifier =SSA_step.identifier ;
239
319
320
+ // update internal field for specific variables in the counterexample
321
+ update_internal_field (SSA_step, goto_trace_step, ns);
322
+
240
323
goto_trace_step.assignment_type =
241
324
(it->is_assignment ()&&
242
325
(SSA_step.assignment_type ==symex_targett::VISIBLE_ACTUAL_PARAMETER ||
0 commit comments