Skip to content

Commit 97ffac6

Browse files
authored
Merge pull request #4658 from tautschnig/library-check
Check cbmc-library regressions for completeness
2 parents 64f48d6 + e8f5ffd commit 97ffac6

File tree

62 files changed

+479
-435
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+479
-435
lines changed

regression/cbmc-library/Float-div1-refine/main.c

Lines changed: 0 additions & 53 deletions
This file was deleted.

regression/cbmc-library/Float-div1/main.c

Lines changed: 0 additions & 53 deletions
This file was deleted.

regression/cbmc-library/Float-no-simp8/main.c

Lines changed: 0 additions & 19 deletions
This file was deleted.

regression/cbmc-library/Float-to-double1/main.c

Lines changed: 0 additions & 19 deletions
This file was deleted.

regression/cbmc-library/Float_lib1/main.c

Lines changed: 0 additions & 55 deletions
This file was deleted.

regression/cbmc-library/Float_lib2/main.c

Lines changed: 0 additions & 33 deletions
This file was deleted.

regression/cbmc-library/Float_lib2/test.desc

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include <assert.h>
2+
#include <time.h>
3+
4+
int main()
5+
{
6+
__acrt_iob_func();
7+
assert(0);
8+
return 0;
9+
}

regression/cbmc-library/Float-no-simp9/test.desc renamed to regression/cbmc-library/__acrt_iob_func-01/test.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
CORE
1+
KNOWNBUG
22
main.c
3-
--floatbv --no-simplify
3+
--pointer-check --bounds-check
44
^EXIT=0$
55
^SIGNAL=0$
66
^VERIFICATION SUCCESSFUL$
Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,55 @@
11
#include <assert.h>
2+
#include <float.h>
23
#include <math.h>
34

45
int main()
56
{
6-
__builtin_isinf();
7-
assert(0);
8-
return 0;
7+
double xxx;
8+
9+
// Visual Studio needs to be 2013 onwards
10+
#if defined(_MSC_VER) && !defined(__CYGWIN__) && _MSC_VER < 1800
11+
12+
// see http://www.johndcook.com/math_h.html
13+
14+
#else
15+
assert(fpclassify(DBL_MAX + DBL_MAX) == FP_INFINITE);
16+
assert(fpclassify(0 * (DBL_MAX + DBL_MAX)) == FP_NAN);
17+
assert(fpclassify(1.0) == FP_NORMAL);
18+
assert(fpclassify(DBL_MIN) == FP_NORMAL);
19+
assert(fpclassify(DBL_MIN / 2) == FP_SUBNORMAL);
20+
assert(fpclassify(-0.0) == FP_ZERO);
21+
#endif
22+
23+
#if !defined(__clang__) && defined(__GNUC__)
24+
assert(__builtin_fpclassify(0, 1, 2, 3, 4, DBL_MAX + DBL_MAX) == 1);
25+
assert(__builtin_fpclassify(0, 1, 2, 3, 4, 0 * (DBL_MAX + DBL_MAX)) == 0);
26+
assert(__builtin_fpclassify(0, 1, 2, 3, 4, 1.0) == 2);
27+
assert(__builtin_fpclassify(0, 1, 2, 3, 4, DBL_MIN) == 2);
28+
assert(__builtin_fpclassify(0, 1, 2, 3, 4, DBL_MIN / 2) == 3);
29+
assert(__builtin_fpclassify(0, 1, 2, 3, 4, -0.0) == 4);
30+
31+
assert(__builtin_isinf(DBL_MAX + DBL_MAX) == 1);
32+
assert(__builtin_isinf(0.0) == 0);
33+
assert(__builtin_isinf(-(DBL_MAX + DBL_MAX)) == 1);
34+
35+
assert(__builtin_isinf_sign(DBL_MAX + DBL_MAX) == 1);
36+
assert(__builtin_isinf_sign(0.0) == 0);
37+
assert(__builtin_isinf_sign(-(DBL_MAX + DBL_MAX)) == -1);
38+
39+
// these are compile-time
40+
_Static_assert(
41+
__builtin_fpclassify(0, 1, 2, 3, 4, -0.0) == 4,
42+
"__builtin_fpclassify is constant");
43+
44+
_Static_assert(__builtin_isnormal(DBL_MIN), "__builtin_isnormal is constant");
45+
46+
_Static_assert(!__builtin_isinf(0.0), "__builtin_isinf is constant");
47+
48+
_Static_assert(
49+
__builtin_isinf_sign(0.0) == 0, "__builtin_isinf_sign is constant");
50+
51+
#endif
52+
53+
assert(signbit(-1.0) != 0);
54+
assert(signbit(1.0) == 0);
955
}

0 commit comments

Comments
 (0)