Skip to content

Commit 2a12580

Browse files
committed
C library: implement feraiseexcept
Model floating-point exceptions as failing assertions.
1 parent 9d6c3a5 commit 2a12580

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include <assert.h>
2+
#include <fenv.h>
3+
4+
int main()
5+
{
6+
int exceptions;
7+
feraiseexcept(exceptions);
8+
return 0;
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
4+
^VERIFICATION FAILED$
5+
^EXIT=10$
6+
^SIGNAL=0$
7+
--
8+
^warning: ignoring

src/ansi-c/library/fenv.c

+9
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,12 @@ __CPROVER_HIDE:;
4040
0;
4141
return 0; // we never fail
4242
}
43+
44+
/* FUNCTION: feraiseexcept */
45+
46+
int feraiseexcept(int excepts)
47+
{
48+
__CPROVER_HIDE:;
49+
__CPROVER_assert(excepts == 0, "floating-point exception");
50+
return 0; // we never fail
51+
}

0 commit comments

Comments
 (0)