jburnim / crest

CREST is a concolic test generation tool for C.
http://jburnim.github.io/crest/
BSD 2-Clause "Simplified" License
158 stars 50 forks source link

big integer in condition bug #6

Closed kren1 closed 7 years ago

kren1 commented 7 years ago

If I compile and run

#include <crest.h>
unsigned int a;
int main() {
    __CrestUInt(&a);
    printf("a: %d\n",a);
    if( a < 4294967295) {
        exit(0);
    }
}

with something like crestc example.c && run_crest ./example 1000 -dfs

I get

Iteration 0 (0s): covered 0 branches [0 reach funs, 0 reach branches].
a: 1058183384
Iteration 1 (0s): covered 1 branches [1 reach funs, 2 reach branches].
a: 0
Iteration 2 (0s): covered 1 branches [1 reach funs, 2 reach branches].
Prediction failed!

So what I assume is happening is that in iteration 1 a path that skips the if is meant to be taken, but a gets set to 0 for some reason, so the path with the if is taken again which causes the prediction failed. This behaviour can be observed for quite a while, for example it happens if the constant is 2294967295 and disappears by the time it is 1294967295.

Is this a real bug or some known limitation?

jburnim commented 7 years ago

Thanks for the bug report!

I think a few different things are going on here:

kren1 commented 7 years ago

Thanks for the response