You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Field of type Code in struct when making closure #1243
So I believe that the problem is that the move || g() closure stores the field g of type impl Fn() -> (). This gets compiled to Code { ... } (i.e. a C function type), but it should be compiled to a function pointer type. To fix this, we probably have to make sure that closures fields only store function pointers in GotoC, even if it is a move closure in Rust, i.e. if the field is not behind a reference in Rust.
Activity
tautschnig commentedon Jun 3, 2022
I believe we had actually seen this before: diffblue/cbmc#6370
fzaiser commentedon Jun 22, 2022
Reduced test case:
fzaiser commentedon Jun 23, 2022
So I believe that the problem is that the
move || g()closure stores the fieldgof typeimpl Fn() -> (). This gets compiled toCode { ... }(i.e. a C function type), but it should be compiled to a function pointer type. To fix this, we probably have to make sure that closures fields only store function pointers in GotoC, even if it is amoveclosure in Rust, i.e. if the field is not behind a reference in Rust.