Skip to content

Unexpected verification result related to long double #3708

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
muchang opened this issue Jan 7, 2019 · 1 comment
Closed

Unexpected verification result related to long double #3708

muchang opened this issue Jan 7, 2019 · 1 comment

Comments

@muchang
Copy link

muchang commented Jan 7, 2019

#include <assert.h>
long double C = 2;
long double U = 1;
long double Y2 = 3;
long double Y1 = 1;
long double X, Y, Z, T, R, S;
int main ()
{
  Z = C + U + U;
  S = Z * Y2;
  Z = S - (Z + U + U);
  if (Z != 6)
    {assert(0);}
return 0; }

CBMC version:5.10
Operating system:Ubuntu 18.04
Exact command line resulting in the issue:cbmc <file.c>
What behaviour did you expect: Result in SUCCESS (proofed by compiling with gcc and executing)
What happened instead:[foo.assertion.1] assertion 0: FAILURE

@kroening
Copy link
Member

kroening commented Jan 8, 2019

The issue here is that compile-time rounding mode (for the initializers, and in particular for Y2) differs from rounding during the computation. This is in principle something the standard permits; in practice, this aspect is usually ignored by compiler builders.
I'll likely fix the compile-time rounding mode to the one given.

kroening pushed a commit that referenced this issue Jan 8, 2019
The rounding mode of the two '3' literals during
the conversion to double should match; issue #3708.
kroening pushed a commit that referenced this issue Jan 8, 2019
The rounding mode of the two '3' literals during
the conversion to double should match; issue #3708.
kroening pushed a commit that referenced this issue Jan 8, 2019
This ensures, among others, that the rounding mode is set before any
initializers are evaluated.

Fixes #3708.
kroening pushed a commit that referenced this issue Jan 9, 2019
This ensures, among others, that the rounding mode is set before any
initializers are evaluated.

Fixes #3708.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants