14
14
#include < cstdlib>
15
15
#include < iostream>
16
16
17
+ #include < util/as_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 (as_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
+ as_const (address_of_expr).object ().type ();
337
339
}
338
340
else
339
341
{
@@ -343,12 +345,13 @@ void goto_symex_statet::rename(
343
345
Forall_operands (it, expr)
344
346
rename (*it, ns, level);
345
347
348
+ const exprt &c_expr = as_const (expr);
346
349
INVARIANT (
347
350
(expr.id () != ID_with ||
348
- expr .type () == to_with_expr (expr ).old ().type ()) &&
351
+ c_expr .type () == to_with_expr (c_expr ).old ().type ()) &&
349
352
(expr.id () != ID_if ||
350
- (expr .type () == to_if_expr (expr ).true_case ().type () &&
351
- expr .type () == to_if_expr (expr ).false_case ().type ())),
353
+ (c_expr .type () == to_if_expr (c_expr ).true_case ().type () &&
354
+ c_expr .type () == to_if_expr (c_expr ).false_case ().type ())),
352
355
" Type of renamed expr should be the same as operands for with_exprt and "
353
356
" if_exprt" );
354
357
}
0 commit comments