File tree Expand file tree Collapse file tree 7 files changed +86
-4
lines changed
Expand file tree Collapse file tree 7 files changed +86
-4
lines changed Original file line number Diff line number Diff line change 11#include <assert.h>
2- #include <unistd.h>
2+ #ifndef _WIN32
3+ # include <unistd.h>
4+ #else
5+ unsigned _sleep (unsigned );
6+ #endif
37
48int main ()
59{
6- _sleep ();
7- assert (0 );
10+ assert (_sleep (42 ) <= 42 );
811 return 0 ;
912}
Original file line number Diff line number Diff line change 1- KNOWNBUG
1+ CORE
22main.c
33--pointer-check --bounds-check
44^EXIT=0$
Original file line number Diff line number Diff line change 1+ #include <assert.h>
2+ #ifndef _WIN32
3+ # include <unistd.h>
4+ #else
5+ int _usleep (unsigned );
6+ #endif
7+
8+ int main ()
9+ {
10+ unsigned input ;
11+ int retval = _usleep (input );
12+ assert (retval == 0 || retval == -1 );
13+ return 0 ;
14+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ main.c
3+ --pointer-check --bounds-check
4+ ^EXIT=0$
5+ ^SIGNAL=0$
6+ ^VERIFICATION SUCCESSFUL$
7+ --
8+ ^warning: ignoring
Original file line number Diff line number Diff line change 1+ #include <assert.h>
2+ #ifndef _WIN32
3+ # include <unistd.h>
4+ #else
5+ int usleep (unsigned );
6+ #endif
7+
8+ int main ()
9+ {
10+ unsigned input ;
11+ int retval = usleep (input );
12+ assert (retval == 0 || retval == -1 );
13+ return 0 ;
14+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ main.c
3+ --pointer-check --bounds-check
4+ ^EXIT=0$
5+ ^SIGNAL=0$
6+ ^VERIFICATION SUCCESSFUL$
7+ --
8+ ^warning: ignoring
Original file line number Diff line number Diff line change @@ -22,6 +22,41 @@ unsigned int _sleep(unsigned int seconds)
2222 return sleep (seconds );
2323}
2424
25+ /* FUNCTION: usleep */
26+
27+ #ifndef __CPROVER_ERRNO_H_INCLUDED
28+ # include <errno.h>
29+ # define __CPROVER_ERRNO_H_INCLUDED
30+ #endif
31+
32+ __CPROVER_bool __VERIFIER_nondet___CPROVER_bool (void );
33+
34+ int usleep (unsigned int usec )
35+ {
36+ __CPROVER_HIDE :;
37+ // do nothing, but return nondet value
38+ __CPROVER_bool error = __VERIFIER_nondet___CPROVER_bool ();
39+ if (error )
40+ {
41+ if (usec >= 1000000 )
42+ errno = EINVAL ;
43+ else
44+ errno = EINTR ;
45+ return -1 ;
46+ }
47+ return 0 ;
48+ }
49+
50+ /* FUNCTION: _usleep */
51+
52+ int usleep (unsigned int );
53+
54+ int _usleep (unsigned int usec )
55+ {
56+ __CPROVER_HIDE :;
57+ return usleep (usec );
58+ }
59+
2560/* FUNCTION: unlink */
2661
2762int __VERIFIER_nondet_int (void );
You can’t perform that action at this time.
0 commit comments