Skip to content

Unexpected verification result about nested struct initialization #3653

@muchang

Description

@muchang
#include <assert.h>

typedef int T[];

struct f { int w; T x; };

static struct f f = { 4, { 0, 1, 2, 3 } };

int main()
{
  int i;
  for (i = 0; i < f.w; ++i)
  {
     if (f.x[i] != i)
        { assert(0);} 
  }
 return 0; 
}

CBMC version: 5.10
Operating system: Ubuntu 18.04
Exact command line resulting in the issue: cbmc <file.c>
What behaviour did you expect: result in SUCCESS (proofed by compiling with gcc and executing)
What happened instead: [main.assertion.1] assertion 0: FAILURE

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions