Skip to content

Invariant violation when dumping C code with anonymous structs or unions #7860

Open
@mstachyraa

Description

@mstachyraa

CBMC version: 5.89.0
Operating system: ubuntu-20.04 x86_64 GNU/Linux
Exact command line resulting in the issue: goto-cc test9.c -o test9; goto-instrument --dump-c test9
What behaviour did you expect: Program should generate C code from goto binary
What happened instead: Invariant check failed

Program fails to dump C code from binary with this pattern:

struct struct2 {
    unsigned int data;
};

struct struct1 {
    union {
        struct struct2 type[5];
        struct {
            struct struct2 *pointer; // <- "struct struct2 pointer;" wouldn't fail
        };
    };
};

int main() {
struct struct1 strct;
}

Gdb lookup:

b dump_c.cpp:623
run --dump-c test9
info locals
print comp_type.id()

s = "union { struct struct2 type[5l]; struct anonymous $anon0; unsigned __CPROVER_bitvector[192] $pad; } $anon0"
$2 = (const irep_idt &) @0x55555649efb4: {no = 498}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions