Skip to content

Commit 16240af

Browse files
authored
Merge pull request #6904 from tautschnig/bugfixes/fmax-f-l
C library: whitespace fix to make fmaxf, fmaxl available
2 parents 98d4551 + 840c4ec commit 16240af

File tree

13 files changed

+76
-19
lines changed

13 files changed

+76
-19
lines changed

regression/cbmc-library/fmax-01/main.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33

44
int main()
55
{
6-
fmax();
7-
assert(0);
6+
double d1, d2;
7+
__CPROVER_assume(!isnan(d1) || !isnan(d2));
8+
double r = fmax(d1, d2);
9+
assert(!isnan(d1) || r == d2);
10+
assert(!isnan(d2) || r == d1);
11+
assert(isnan(d1) || isnan(d2) || (d1 > d2 ? r == d1 : r == d2));
812
return 0;
913
}

regression/cbmc-library/fmax-01/test.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
KNOWNBUG
1+
CORE
22
main.c
3-
--pointer-check --bounds-check
3+
--pointer-check --bounds-check --nan-check
44
^EXIT=0$
55
^SIGNAL=0$
66
^VERIFICATION SUCCESSFUL$
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include <assert.h>
2+
#include <math.h>
3+
4+
int main()
5+
{
6+
float f1, f2;
7+
__CPROVER_assume(!isnan(f1) || !isnan(f2));
8+
float r = fmaxf(f1, f2);
9+
assert(!isnan(f1) || r == f2);
10+
assert(!isnan(f2) || r == f1);
11+
assert(isnan(f1) || isnan(f2) || (f1 > f2 ? r == f1 : r == f2));
12+
return 0;
13+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
--pointer-check --bounds-check --nan-check
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
8+
^warning: ignoring
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include <assert.h>
2+
#include <math.h>
3+
4+
int main()
5+
{
6+
long double d1, d2;
7+
__CPROVER_assume(!isnan(d1) || !isnan(d2));
8+
long double r = fmaxl(d1, d2);
9+
assert(!isnan(d1) || r == d2);
10+
assert(!isnan(d2) || r == d1);
11+
assert(isnan(d1) || isnan(d2) || (d1 > d2 ? r == d1 : r == d2));
12+
return 0;
13+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
--pointer-check --bounds-check --nan-check
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
8+
^warning: ignoring

regression/cbmc-library/fmin-01/main.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33

44
int main()
55
{
6-
fmin();
7-
assert(0);
6+
double d1, d2;
7+
__CPROVER_assume(!isnan(d1) || !isnan(d2));
8+
double r = fmin(d1, d2);
9+
assert(!isnan(d1) || r == d2);
10+
assert(!isnan(d2) || r == d1);
11+
assert(isnan(d1) || isnan(d2) || (d1 < d2 ? r == d1 : r == d2));
812
return 0;
913
}

regression/cbmc-library/fmin-01/test.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
KNOWNBUG
1+
CORE
22
main.c
3-
--pointer-check --bounds-check
3+
--pointer-check --bounds-check --nan-check
44
^EXIT=0$
55
^SIGNAL=0$
66
^VERIFICATION SUCCESSFUL$

regression/cbmc-library/fminf-01/main.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33

44
int main()
55
{
6-
fminf();
7-
assert(0);
6+
float f1, f2;
7+
__CPROVER_assume(!isnan(f1) || !isnan(f2));
8+
float r = fminf(f1, f2);
9+
assert(!isnan(f1) || r == f2);
10+
assert(!isnan(f2) || r == f1);
11+
assert(isnan(f1) || isnan(f2) || (f1 < f2 ? r == f1 : r == f2));
812
return 0;
913
}

regression/cbmc-library/fminf-01/test.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
KNOWNBUG
1+
CORE
22
main.c
3-
--pointer-check --bounds-check
3+
--pointer-check --bounds-check --nan-check
44
^EXIT=0$
55
^SIGNAL=0$
66
^VERIFICATION SUCCESSFUL$

regression/cbmc-library/fminl-01/main.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33

44
int main()
55
{
6-
fminl();
7-
assert(0);
6+
long double d1, d2;
7+
__CPROVER_assume(!isnan(d1) || !isnan(d2));
8+
long double r = fminl(d1, d2);
9+
assert(!isnan(d1) || r == d2);
10+
assert(!isnan(d2) || r == d1);
11+
assert(isnan(d1) || isnan(d2) || (d1 < d2 ? r == d1 : r == d2));
812
return 0;
913
}

regression/cbmc-library/fminl-01/test.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
KNOWNBUG
1+
CORE
22
main.c
3-
--pointer-check --bounds-check
3+
--pointer-check --bounds-check --nan-check
44
^EXIT=0$
55
^SIGNAL=0$
66
^VERIFICATION SUCCESSFUL$

src/ansi-c/library/math.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,7 +1077,7 @@ long double sqrtl(long double d)
10771077
// TODO : Should call a __CPROVER_function so that it can be converted to SMT-LIB
10781078
double fmax(double f, double g) { return ((f >= g) || isnan(g)) ? f : g; }
10791079

1080-
/* FUNCTION : fmaxf */
1080+
/* FUNCTION: fmaxf */
10811081

10821082
#ifndef __CPROVER_MATH_H_INCLUDED
10831083
#include <math.h>
@@ -1087,8 +1087,7 @@ double fmax(double f, double g) { return ((f >= g) || isnan(g)) ? f : g; }
10871087
// TODO : Should call a __CPROVER_function so that it can be converted to SMT-LIB
10881088
float fmaxf(float f, float g) { return ((f >= g) || isnan(g)) ? f : g; }
10891089

1090-
1091-
/* FUNCTION : fmaxl */
1090+
/* FUNCTION: fmaxl */
10921091

10931092
#ifndef __CPROVER_MATH_H_INCLUDED
10941093
#include <math.h>

0 commit comments

Comments
 (0)