File tree Expand file tree Collapse file tree 5 files changed +64
-4
lines changed Expand file tree Collapse file tree 5 files changed +64
-4
lines changed Original file line number Diff line number Diff line change 1
1
#include <assert.h>
2
- #include <unistd.h>
2
+ #ifndef _WIN32
3
+ # include <unistd.h>
4
+ #else
5
+ unsigned _sleep (unsigned );
6
+ #endif
3
7
4
8
int main ()
5
9
{
6
- _sleep ();
7
- assert (0 );
10
+ assert (_sleep (42 ) <= 42 );
8
11
return 0 ;
9
12
}
Original file line number Diff line number Diff line change 1
- KNOWNBUG
1
+ CORE
2
2
main.c
3
3
--pointer-check --bounds-check
4
4
^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 @@ -22,6 +22,41 @@ unsigned int _sleep(unsigned int seconds)
22
22
return sleep (seconds );
23
23
}
24
24
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
+
25
60
/* FUNCTION: unlink */
26
61
27
62
int __VERIFIER_nondet_int (void );
You can’t perform that action at this time.
0 commit comments