File tree 2 files changed +10
-6
lines changed
regression/snapshot-harness/pointer-to-array-int
2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -33,12 +33,10 @@ int main()
33
33
assert (first == second );
34
34
// The following assertions will be check in the following PR once
35
35
// dynamically allocated snapshots are properly implemented.
36
- /* assert(array_size >= prefix_size); */
37
- /* assert(prefix_size >= 0); */
38
- /* assert(second[prefix_size] != 6); */
39
- /* assert(second[4] == 4); */
36
+ assert (array_size >= prefix_size );
37
+ assert (prefix_size >= 0 );
38
+ assert (second [prefix_size ] != 6 );
39
+ assert (second [4 ] == 4 );
40
40
41
- /* for(int i = 0; i < prefix_size; i++) */
42
- /* assert(second[i] != prefix[i]); */
43
41
return 0 ;
44
42
}
Original file line number Diff line number Diff line change @@ -387,6 +387,7 @@ exprt gdb_value_extractort::get_non_char_pointer_value(
387
387
// add assignment of value to newly created symbol
388
388
add_assignment (array_symbol, new_array);
389
389
values[memory_location] = array_symbol;
390
+ CHECK_RETURN (array_symbol.type ().id () == ID_array);
390
391
return array_symbol;
391
392
}
392
393
@@ -409,6 +410,8 @@ exprt gdb_value_extractort::get_non_char_pointer_value(
409
410
{
410
411
const auto &known_value = it->second ;
411
412
const auto &expected_type = expr.type ().subtype ();
413
+ if (find_dynamic_allocation (memory_location) != dynamically_allocated.end ())
414
+ return known_value;
412
415
if (known_value.is_not_nil () && known_value.type () != expected_type)
413
416
{
414
417
return symbol_exprt{to_symbol_expr (known_value).get_identifier (),
@@ -500,7 +503,10 @@ exprt gdb_value_extractort::get_pointer_value(
500
503
const auto result_indexed_expr = get_subexpression_at_offset (
501
504
target_expr, 0 , zero_expr.type ().subtype (), ns);
502
505
CHECK_RETURN (result_indexed_expr.has_value ());
506
+ if (result_indexed_expr->type () == zero_expr.type ())
507
+ return *result_indexed_expr;
503
508
const auto result_expr = address_of_exprt{*result_indexed_expr};
509
+ CHECK_RETURN (result_expr.type () == zero_expr.type ());
504
510
return result_expr;
505
511
}
506
512
You can’t perform that action at this time.
0 commit comments