Skip to content

Is this a bug? #324

Open
Open
@chkl

Description

@chkl

Hello,
I stumbled upon the following phenomenon:
Consider this file interesting-simplified.c:

> cat interesting-simplified.c 
extern void __VERIFIER_error() __attribute__((__noreturn__));
void __VERIFIER_assert(int cond)
{
    if (!cond)
    {
    ERROR:
        __VERIFIER_error();
    }
}
int main()
{
    int i = 0;
    while (i < 100000)
    {
        i = i + 1;
    }
    __VERIFIER_assert(i != 11);
    return 0;
}

Running > CORRAL="mono /tmp/corral/bin/Release/corral.exe" smack -x=svcomp --clang-options=-m32 interesting-simplified.c results in the output:

SMACK program verifier version 1.9.0
SMACK found no errors with unroll bound 1.

Now, when I just change the assertion from i != 11 to i != 10, the output changes to:

SMACK program verifier version 1.9.0
/usr/local/share/smack/lib/smack.c(47,1): This assertion can fail
Execution trace:
    /usr/local/share/smack/lib/smack.c(1782,3): Trace: Thread=1  (CALL $initialize, CALL __SMACK_static_init, RETURN from __SMACK_static_init , CALL __SMACK_init_func_memory_model)
    /usr/local/share/smack/lib/smack.c(1782,3): Trace: Thread=1  ()
    /usr/local/share/smack/lib/smack.c(1787,1): Trace: Thread=1  ()
    /database/random5_budgets/interesting-simplified-xfPVOF.c(13,5): Trace: Thread=1  (RETURN from __SMACK_init_func_memory_model , RETURN from $initialize )
    /database/random5_budgets/interesting-simplified-xfPVOF.c(13,5): Trace: Thread=1  ()
    /database/random5_budgets/interesting-simplified-xfPVOF.c(13,5): Trace: Thread=1  (smack:entry:main = -4134)
    /database/random5_budgets/interesting-simplified-xfPVOF.c(13,5): Trace: Thread=1  ()
    /database/random5_budgets/interesting-simplified-xfPVOF.c(17,5): Trace: Thread=1  ()
    /database/random5_budgets/interesting-simplified-xfPVOF.c(17,5): Trace: Thread=1  (CALL __VERIFIER_assert)
    /database/random5_budgets/interesting-simplified-xfPVOF.c(4,10): Trace: Thread=1  ()
    /database/random5_budgets/interesting-simplified-xfPVOF.c(4,9): Trace: Thread=1  ()
    /database/random5_budgets/interesting-simplified-xfPVOF.c(5,5): Trace: Thread=1  ()
    /database/random5_budgets/interesting-simplified-xfPVOF.c(7,9): Trace: Thread=1  ()
    /database/random5_budgets/interesting-simplified-xfPVOF.c(7,9): Trace: Thread=1  (CALL __VERIFIER_error)
    /usr/local/share/smack/lib/smack.c(47,3): Trace: Thread=1  ()
    /usr/local/share/smack/lib/smack.c(47,3): Trace: Thread=1  (ASSERTION FAILS assert false;
    /database/random5_budgets/interesting-simplified-xfPVOF.c(7,9): Trace: Thread=1  (RETURN from __VERIFIER_error )
    /database/random5_budgets/interesting-simplified-xfPVOF.c(17,5): Trace: Thread=1  (RETURN from __VERIFIER_assert )
    /database/random5_budgets/interesting-simplified-xfPVOF.c(17,5): Trace: Thread=1  (Done)

SMACK found an error.

To my limited understanding, smack uses bounded model checking so I would understand if in both cases it didn't reach the 100000th loop unrolling. What I don't understand is that the result depends on whether the assertion contains a 10 or an 11.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions