Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid conversion check failure sysconf library model #7824

Merged
merged 1 commit into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions regression/cbmc-library/sysconf-01/test.desc
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
CORE unix
main.c

--pointer-check --bounds-check --conversion-check
^\[main.assertion.\d+\] line \d+ ARG\_MAX is not supported: FAILURE$
^\[main.assertion.\d+\] line \d+ sysconf\(\) error: FAILURE$
^\[main.assertion.\d+\] line \d+ ARG\_MAX is supported: FAILURE$
^\*\* 3 of 3 failed .*$
^\*\* 3 of \d+ failed .*$
^VERIFICATION FAILED$
^EXIT=10$
^SIGNAL=0$
--
^WARNING: no body for function sysconf
^\*\*\*\* WARNING: no body for function sysconf
10 changes: 5 additions & 5 deletions src/ansi-c/library/unistd.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ ret_type _read(int fildes, void *buf, size_type nbyte)
#endif

long __VERIFIER_nondet_long(void);
unsigned int __VERIFIER_nondet_unsigned_int(void);
int __VERIFIER_nondet_int(void);

long sysconf(int name);

Expand All @@ -340,13 +340,13 @@ __CPROVER_HIDE:;
(void)name;
long retval = __VERIFIER_nondet_long();

// We should keep errno as non-determinist as possible, since this model
// nver takes into account the name input.
errno = __VERIFIER_nondet_unsigned_int();
// We should keep errno as non-deterministic as possible, since this model
// never takes into account the name input.
errno = __VERIFIER_nondet_int();

// Spec states "some returned values may be huge; they are not suitable
// for allocating memory". There aren't also guarantees about return
// values being strickly equal or greater to -1.
// values being strictly equal or greater to -1.
// Thus, modelling it as non-deterministic.
return retval;
}
Loading