Skip to content

Commit 0a157dd

Browse files
committed
Fix accesses to exprt::opX() in ansi-c/
This improves type safety, and will enable restricing the exprt interface. These are the final ones in ansi-c/.
1 parent 57de946 commit 0a157dd

File tree

3 files changed

+116
-113
lines changed

3 files changed

+116
-113
lines changed

src/ansi-c/c_typecheck_expr.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2671,10 +2671,11 @@ exprt c_typecheck_baset::do_special_functions(
26712671
if(
26722672
tmp1.id() == ID_typecast &&
26732673
to_typecast_expr(tmp1).op().id() == ID_address_of &&
2674-
to_typecast_expr(tmp1).op().operands().size() == 1 &&
2675-
to_typecast_expr(tmp1).op().op0().id() == ID_index &&
2676-
to_typecast_expr(tmp1).op().op0().operands().size() == 2 &&
2677-
to_typecast_expr(tmp1).op().op0().op0().id() == ID_string_constant)
2674+
to_address_of_expr(to_typecast_expr(tmp1).op()).object().id() ==
2675+
ID_index &&
2676+
to_index_expr(to_address_of_expr(to_typecast_expr(tmp1).op()).object())
2677+
.array()
2678+
.id() == ID_string_constant)
26782679
{
26792680
is_constant=true;
26802681
}

0 commit comments

Comments
 (0)