Skip to content

cbmc invariant violation in rewrite_with_to_field_symbols #4933

@andreast271

Description

@andreast271

CBMC version: 5.12 (cbmc-5.12-d8598f8-557-g1edf4d91f)
Operating system: CentOS Linux 7
Exact command line resulting in the issue: cbmc struct_array.c
What behaviour did you expect: no invariant violation
What happened instead: invariant violation

cbmc symbolic simulation fails with an invariant violation in function rewrite_with_to_field_symbols when it tries to simulate the following c code:

typedef struct _MyStruct {
    int m_a;
} MyStruct;

typedef struct _MyArrayStruct {
    MyStruct m_ar[2];
} MyArrayStruct;

int main()
{
  MyArrayStruct mas;
  int a, i;
  i = 1;
  (mas.m_ar + i)->m_a = a;
  //(mas.m_ar + 1)->m_a = a;
  //mas.m_ar[i].m_a = a;
  return 0;
}

The failure is caused in expr_skeletont::clear_innermost_member_expr when deepest_not_nil returns a byte_extract expression and the code expects it to return a member expression.
Either of the two lines that are commented out in the code above do not lead to an invariant failure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions