Skip to content

CBMC silently omits invalid struct field in GotoC output #6984

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fzaiser opened this issue Jun 29, 2022 · 1 comment · Fixed by #6892
Closed

CBMC silently omits invalid struct field in GotoC output #6984

fzaiser opened this issue Jun 29, 2022 · 1 comment · Fixed by #6892
Labels
aws Bugs or features of importance to AWS CBMC users Kani Bugs or features of importance to Kani Rust Verifier pending merge

Comments

@fzaiser
Copy link

fzaiser commented Jun 29, 2022

I discovered this bug working on Kani, in particular the bug model-checking/kani#1243 with @danielsn. Kani there tries to create a struct with a field of type code, which is not allowed in C because a function cannot be stored directly in a struct but has to be behind a pointer. The symbol table correctly records this invalid field type, but the GotoC output (produced with goto-instrument --dump-c) silently omits this invalid field, which confused us for a while when debugging the Kani issue.

CBMC version: 5.60.0
Operating system: macOS 12.3.1
Exact command line resulting in the issue: kani --enable-unstable --gen-c --keep-temps test.rs (I cannot provide a direct example using C code because the issue is about invalid C code only encountered in Kani.)
What behaviour did you expect: CBMC outputs a warning about an invalid struct field or generates some output in test.out.c about the field.
What happened instead: The invalid field is silently omitted in the output.

@danielsn danielsn added the aws Bugs or features of importance to AWS CBMC users label Jun 29, 2022
@tautschnig
Copy link
Collaborator

This would have been fixed by #6892 already, just waiting for code reviews.

tautschnig added a commit to tautschnig/cbmc that referenced this issue Jun 30, 2022
It's only the C++ front-end that puts methods in struct members, and
this should not leak into GOTO programs. We can, therefore, clean up a
number of unnecessary branches.

Fixes: diffblue#6984
tautschnig added a commit to tautschnig/cbmc that referenced this issue Aug 12, 2022
It's only the C++ front-end that puts methods in struct members, and
this should not leak into GOTO programs. We can, therefore, clean up a
number of unnecessary branches.

Fixes: diffblue#6984
tautschnig added a commit to tautschnig/cbmc that referenced this issue Sep 28, 2022
It's only the C++ front-end that puts methods in struct members, and
this should not leak into GOTO programs. We can, therefore, clean up a
number of unnecessary branches.

Fixes: diffblue#6984
tautschnig added a commit to tautschnig/cbmc that referenced this issue Oct 27, 2022
It's only the C++ front-end that puts methods in struct members, and
this should not leak into GOTO programs. We can, therefore, clean up a
number of unnecessary branches.

Fixes: diffblue#6984
@jimgrundy jimgrundy added the Kani Bugs or features of importance to Kani Rust Verifier label Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws Bugs or features of importance to AWS CBMC users Kani Bugs or features of importance to Kani Rust Verifier pending merge
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants