14
14
#include < cstdlib>
15
15
#include < iostream>
16
16
17
+ #include < util/add_const.h>
17
18
#include < util/base_exceptions.h>
18
19
#include < util/exception_utils.h>
19
20
#include < util/expr_util.h>
@@ -315,7 +316,7 @@ void goto_symex_statet::rename(
315
316
else if (expr.id ()==ID_symbol)
316
317
{
317
318
// we never rename function symbols
318
- if (expr.type ().id () == ID_code)
319
+ if (add_const ( expr) .type ().id () == ID_code)
319
320
{
320
321
rename (
321
322
expr.type (),
@@ -333,7 +334,8 @@ void goto_symex_statet::rename(
333
334
{
334
335
auto &address_of_expr = to_address_of_expr (expr);
335
336
rename_address (address_of_expr.object (), ns, level);
336
- to_pointer_type (expr.type ()).subtype () = address_of_expr.object ().type ();
337
+ to_pointer_type (expr.type ()).subtype () =
338
+ add_const (address_of_expr).object ().type ();
337
339
}
338
340
else
339
341
{
@@ -345,10 +347,12 @@ void goto_symex_statet::rename(
345
347
346
348
INVARIANT (
347
349
(expr.id () != ID_with ||
348
- expr.type () == to_with_expr (expr).old ().type ()) &&
350
+ add_const ( expr) .type () == to_with_expr (add_const ( expr) ).old ().type ()) &&
349
351
(expr.id () != ID_if ||
350
- (expr.type () == to_if_expr (expr).true_case ().type () &&
351
- expr.type () == to_if_expr (expr).false_case ().type ())),
352
+ (add_const (expr).type () ==
353
+ to_if_expr (add_const (expr)).true_case ().type () &&
354
+ add_const (expr).type () ==
355
+ to_if_expr (add_const (expr)).false_case ().type ())),
352
356
" Type of renamed expr should be the same as operands for with_exprt and "
353
357
" if_exprt" );
354
358
}
0 commit comments