Line data Source code
1 : /*
2 : * Copyright (c) 2014-2016 ISPRAS (http://www.ispras.ru)
3 : * Institute for System Programming of the Russian Academy of Sciences
4 : *
5 : * Licensed under the Apache License, Version 2.0 (the "License");
6 : * you may not use this file except in compliance with the License.
7 : * You may obtain a copy of the License at
8 : *
9 : * http://www.apache.org/licenses/LICENSE-2.0
10 : *
11 : * Unless required by applicable law or agreed to in writing, software
12 : * distributed under the License is distributed on an "AS IS" BASIS,
13 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 : * ee the License for the specific language governing permissions and
15 : * limitations under the License.
16 : */
17 :
18 : #include <verifier/common.h>
19 : #include <verifier/nondet.h>
20 : #include <linux/types.h>
21 :
22 : /* SV-COMP functions intended for modelling nondeterminism. */
23 : char __VERIFIER_nondet_char(void);
24 : int __VERIFIER_nondet_int(void);
25 : float __VERIFIER_nondet_float(void);
26 : long __VERIFIER_nondet_long(void);
27 : size_t __VERIFIER_nondet_size_t(void);
28 : loff_t __VERIFIER_nondet_loff_t(void);
29 : u32 __VERIFIER_nondet_u32(void);
30 : u16 __VERIFIER_nondet_u16(void);
31 : u8 __VERIFIER_nondet_u8(void);
32 : unsigned char __VERIFIER_nondet_uchar(void);
33 : unsigned int __VERIFIER_nondet_uint(void);
34 : unsigned short __VERIFIER_nondet_ushort(void);
35 : unsigned __VERIFIER_nondet_unsigned(void);
36 : unsigned long __VERIFIER_nondet_ulong(void);
37 : void *__VERIFIER_nondet_pointer(void);
38 : void __VERIFIER_assume(int expression);
39 :
40 : int ldv_undef_int(void) {
41 2 : return __VERIFIER_nondet_int();
42 1 : }
43 :
44 : void *ldv_undef_ptr(void) {
45 0 : return __VERIFIER_nondet_pointer();
46 0 : }
47 :
48 : unsigned long ldv_undef_ulong(void) {
49 0 : return __VERIFIER_nondet_ulong();
50 0 : }
51 :
52 : int ldv_undef_int_negative(void)
53 : {
54 0 : int ret = ldv_undef_int();
55 0 : ldv_assume(ret < 0);
56 0 : return ret;
57 : }
58 :
59 : int ldv_undef_int_nonpositive(void)
60 : {
61 0 : int ret = ldv_undef_int();
62 0 : ldv_assume(ret <= 0);
63 0 : return ret;
64 : }
|