Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions regression/cbmc/member1/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
struct B
{
int bi;
int *c;
};

struct A
{
int ai;
struct B b;
};

int main()
{
struct A *a;
if((&a->b)->c == 0)
return 1;
return 0;
}
9 changes: 9 additions & 0 deletions regression/cbmc/member1/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CORE
main.c
--pointer-check
^EXIT=10$
^SIGNAL=0$
^VERIFICATION FAILED$
--
^warning: ignoring
add/sub with mixed types
5 changes: 4 additions & 1 deletion src/analyses/goto_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1414,7 +1414,10 @@ void goto_checkt::check_rec(const exprt &expr, guardt &guard, bool address)
deref.pointer(), pointer_type(char_type()));

const exprt new_address = typecast_exprt(
plus_exprt(char_pointer, member_offset), char_pointer.type());
plus_exprt(
char_pointer,
typecast_exprt::conditional_cast(member_offset, pointer_diff_type())),
char_pointer.type());

const exprt new_address_casted =
typecast_exprt::conditional_cast(new_address, new_pointer_type);
Expand Down