Skip to content

Bug: Memcpy with #memory_int and #memory_real present #744

@jankoerner

Description

@jankoerner

Basic Info

  • Commit: 0f2a44d (currently dev)
  • Input file:
int main() { 
    int* i = (int*) malloc(sizeof(int));
    *i = 42;
    
    int* i2 = (int*) malloc(sizeof(int));
    memcpy(i2, i, sizeof(int));
    assert(*i2 == 42);

    float* f1 = (float*) malloc(sizeof(float));
    *f1 = 44.0;
    
    return 0;
}

Description

Given the following program, I would assume that both asserts hold, however Ultimate reports that assert(i2 == 42) can be violated.

What's interesting is the fact, that Ultimate reports that this assert(*i2 == 42) holds, if the malloc of the floating point is removed.
I assume that this problem might be related to the fact, that the floating point allocation introduces the #memory_real map into the Boogie code, which then leads to #Ultimate.C_memcpy writing to #memory_int and #memory_real.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions