Skip to content

Commit 8ddf489

Browse files
author
Daniel Kroening
committed
use conditional_cast instead of make_typecast
make_typecast isn't type safe; typecast_exprt::conditional_cast is.
1 parent 2db2b53 commit 8ddf489

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/goto-programs/remove_function_pointers.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -391,13 +391,13 @@ void remove_function_pointerst::remove_function_pointer(
391391
t3->make_goto(t_final, true_exprt());
392392

393393
// goto to call
394-
address_of_exprt address_of(fun, pointer_type(fun.type()));
394+
const address_of_exprt address_of(fun, pointer_type(fun.type()));
395395

396-
if(address_of.type()!=pointer.type())
397-
address_of.make_typecast(pointer.type());
396+
const auto casted_address =
397+
typecast_exprt::conditional_cast(address_of, pointer.type());
398398

399399
goto_programt::targett t4=new_code_gotos.add_instruction();
400-
t4->make_goto(t1, equal_exprt(pointer, address_of));
400+
t4->make_goto(t1, equal_exprt(pointer, casted_address));
401401
}
402402

403403
// fall-through

0 commit comments

Comments
 (0)