Skip to content

An example with a false assertion doesn't terminate #636

Closed

Description

@zhassan-aws

I tried this code:

#[no_mangle]
fn main() {
    let x: bool = rmc::nondet();
    if x {
        assert!(1 + 1 == 1);
    }
    assert!(1 + 1 == 3);
}

using the following command line invocation:

rmc test.rs

with RMC version: 2141a76f98d

I expected to see this happen: both assertions fail.

Instead, this happened: it runs forever (CBMC keeps unwinding forever). If I specify an unwinding depth, the unwinding assertion fails:

$ rmc test.rs --cbmc-args --unwind 10
.
.
.

** 3 of 78 failed (2 iterations)
VERIFICATION FAILED
[RMC] info: Verification output shows one or more unwinding failures.
[RMC] tip: Consider increasing the unwinding value or disabling `--unwinding-assertions`.

Activity

  1. added
    [C] Bug
    on Nov 10, 2021
  2. changed the title [-]An example with an assert false doesn't terminate[/-] [+]An example with a false assertion doesn't terminate[/+] on Nov 10, 2021
  3. celinval commented on Nov 11, 2021

    @celinval
    Contributor

    I think this may be a duplicated of #545 and I believe it has to do with incorrect unwind logic. I think we should run rmc with abort strategy. I think it's -C panic=abort to avoid the infinite loop.

    Additionally, we have to change how we encode the assertion statement.

  4. self-assigned this
    on Nov 16, 2021
  5. celinval commented on Dec 7, 2021

    @celinval
    Contributor

    I stand corrected. There is a bug on how we are code generating assertions.

  6. added a commit that references this issue on Dec 10, 2021
    56f2aae
  7. added a commit that references this issue on Dec 14, 2021
    625990c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

[C] Bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions