Skip to content

Regression in floating-point floor #8596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
zhassan-aws opened this issue Feb 19, 2025 · 0 comments · Fixed by #8597
Closed

Regression in floating-point floor #8596

zhassan-aws opened this issue Feb 19, 2025 · 0 comments · Fixed by #8597
Labels
Kani Bugs or features of importance to Kani Rust Verifier

Comments

@zhassan-aws
Copy link
Collaborator

For the following C program:

#include <assert.h>
#include <math.h>

int main() {
    float f = -42.6;
    float g = floorf(f);
    assert(g == -43.0);
    return 0;
}

verification fails with the latest commit (0fc8a49):

$ cbmc --version
6.4.1 (cbmc-6.4.1-159-g0fc8a492c8)
$ cbmc ffl.c 
CBMC version 6.4.1 (cbmc-6.4.1-159-g0fc8a492c8) 64-bit x86_64 linux
Type-checking ffl
Generating GOTO Program
Adding CPROVER library (x86_64)
Removal of function pointers and virtual functions
Generic Property Instrumentation
Starting Bounded Model Checking
Passing problem to propositional reduction
converting SSA
Running propositional reduction
SAT checker: instance is SATISFIABLE

** Results:
ffl.c function main
[main.assertion.1] line 7 assertion g == -43.0: FAILURE

** 1 of 1 failed (2 iterations)
VERIFICATION FAILED

which is an incorrect.

The program correctly passes with CBMC 6.4.1:

$ cbmc --version
6.4.1 (cbmc-6.4.1)
$ cbmc ffl.c 
CBMC version 6.4.1 (cbmc-6.4.1-159-g0fc8a492c8) 64-bit x86_64 linux
Type-checking ffl
Generating GOTO Program
Adding CPROVER library (x86_64)
Removal of function pointers and virtual functions
Generic Property Instrumentation
Starting Bounded Model Checking
Passing problem to propositional reduction
converting SSA
Running propositional reduction
SAT checker: instance is SATISFIABLE

** Results:
ffl.c function main
[main.assertion.1] line 7 assertion g == -43.0: FAILURE

** 1 of 1 failed (2 iterations)
VERIFICATION FAILED
@zhassan-aws zhassan-aws added the Kani Bugs or features of importance to Kani Rust Verifier label Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Kani Bugs or features of importance to Kani Rust Verifier
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant