Skip to content

goto-instrument --dump-c still produces invalid code when parameter name overlaps with local variable name #6268

@vecchiot-aws

Description

@vecchiot-aws

CBMC version: 5.35.0 (cbmc-5.35.0-95-ge6f69702f)
Operating system: macOS Big Sur v11.4

Exact command line resulting in the issue:
Though the example in #6242 was fixed, there are still other examples which don't work. I've created a simpler example attached here:

  • Input: test.json
  • Command: symtab2gb test.json --out test.goto; goto-instrument --dump-c test.goto > test.c
  • Output: test.c

What behaviour did you expect: A valid C program is produced.

What happened instead: The parameter and local variables have the same name, leading to a compilation error:

int main(int x)
{
  unsigned int x;
}

If it helps, this was created from the following Rust file using RMC, with manual edits to simplify:

fn help(x: i32) {
    let x: i64;
}

fn main() {
    help(1);
}

Metadata

Metadata

Assignees

Labels

KaniBugs or features of importance to Kani Rust VerifierawsBugs or features of importance to AWS CBMC userspending merge

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions