Showing error 2179

User: Jiri Slaby
Error type: Reachable Error Location
Error type description: A specified error location is reachable in some program path
File location: pthread-atomic/scull_safe.i
Line in file: 752
Project: SV-COMP 2013
Project version: 2.6.28
Tools: Manual Work
Entered: 2013-01-17 16:57:54 UTC


Source:

  1extern int __VERIFIER_nondet_int();
  2typedef unsigned char __u_char;
  3typedef unsigned short int __u_short;
  4typedef unsigned int __u_int;
  5typedef unsigned long int __u_long;
  6typedef signed char __int8_t;
  7typedef unsigned char __uint8_t;
  8typedef signed short int __int16_t;
  9typedef unsigned short int __uint16_t;
 10typedef signed int __int32_t;
 11typedef unsigned int __uint32_t;
 12typedef signed long int __int64_t;
 13typedef unsigned long int __uint64_t;
 14typedef long int __quad_t;
 15typedef unsigned long int __u_quad_t;
 16typedef unsigned long int __dev_t;
 17typedef unsigned int __uid_t;
 18typedef unsigned int __gid_t;
 19typedef unsigned long int __ino_t;
 20typedef unsigned long int __ino64_t;
 21typedef unsigned int __mode_t;
 22typedef unsigned long int __nlink_t;
 23typedef long int __off_t;
 24typedef long int __off64_t;
 25typedef int __pid_t;
 26typedef struct { int __val[2]; } __fsid_t;
 27typedef long int __clock_t;
 28typedef unsigned long int __rlim_t;
 29typedef unsigned long int __rlim64_t;
 30typedef unsigned int __id_t;
 31typedef long int __time_t;
 32typedef unsigned int __useconds_t;
 33typedef long int __suseconds_t;
 34typedef int __daddr_t;
 35typedef long int __swblk_t;
 36typedef int __key_t;
 37typedef int __clockid_t;
 38typedef void * __timer_t;
 39typedef long int __blksize_t;
 40typedef long int __blkcnt_t;
 41typedef long int __blkcnt64_t;
 42typedef unsigned long int __fsblkcnt_t;
 43typedef unsigned long int __fsblkcnt64_t;
 44typedef unsigned long int __fsfilcnt_t;
 45typedef unsigned long int __fsfilcnt64_t;
 46typedef long int __ssize_t;
 47typedef __off64_t __loff_t;
 48typedef __quad_t *__qaddr_t;
 49typedef char *__caddr_t;
 50typedef long int __intptr_t;
 51typedef unsigned int __socklen_t;
 52typedef long unsigned int size_t;
 53
 54typedef __time_t time_t;
 55
 56
 57struct timespec
 58  {
 59    __time_t tv_sec;
 60    long int tv_nsec;
 61  };
 62typedef __pid_t pid_t;
 63struct sched_param
 64  {
 65    int __sched_priority;
 66  };
 67
 68
 69struct __sched_param
 70  {
 71    int __sched_priority;
 72  };
 73typedef unsigned long int __cpu_mask;
 74typedef struct
 75{
 76  __cpu_mask __bits[1024 / (8 * sizeof (__cpu_mask))];
 77} cpu_set_t;
 78
 79extern int __sched_cpucount (size_t __setsize, const cpu_set_t *__setp)
 80  __attribute__ ((__nothrow__ , __leaf__));
 81extern cpu_set_t *__sched_cpualloc (size_t __count) __attribute__ ((__nothrow__ , __leaf__)) ;
 82extern void __sched_cpufree (cpu_set_t *__set) __attribute__ ((__nothrow__ , __leaf__));
 83
 84
 85extern int sched_setparam (__pid_t __pid, __const struct sched_param *__param)
 86     __attribute__ ((__nothrow__ , __leaf__));
 87extern int sched_getparam (__pid_t __pid, struct sched_param *__param) __attribute__ ((__nothrow__ , __leaf__));
 88extern int sched_setscheduler (__pid_t __pid, int __policy,
 89          __const struct sched_param *__param) __attribute__ ((__nothrow__ , __leaf__));
 90extern int sched_getscheduler (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__));
 91extern int sched_yield (void) __attribute__ ((__nothrow__ , __leaf__));
 92extern int sched_get_priority_max (int __algorithm) __attribute__ ((__nothrow__ , __leaf__));
 93extern int sched_get_priority_min (int __algorithm) __attribute__ ((__nothrow__ , __leaf__));
 94extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __attribute__ ((__nothrow__ , __leaf__));
 95
 96
 97
 98typedef __clock_t clock_t;
 99
100
101typedef __clockid_t clockid_t;
102
103
104typedef __timer_t timer_t;
105
106struct tm
107{
108  int tm_sec;
109  int tm_min;
110  int tm_hour;
111  int tm_mday;
112  int tm_mon;
113  int tm_year;
114  int tm_wday;
115  int tm_yday;
116  int tm_isdst;
117  long int tm_gmtoff;
118  __const char *tm_zone;
119};
120
121
122struct itimerspec
123  {
124    struct timespec it_interval;
125    struct timespec it_value;
126  };
127struct sigevent;
128
129extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__));
130extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__));
131extern double difftime (time_t __time1, time_t __time0)
132     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
133extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__));
134extern size_t strftime (char *__restrict __s, size_t __maxsize,
135   __const char *__restrict __format,
136   __const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__));
137
138typedef struct __locale_struct
139{
140  struct __locale_data *__locales[13];
141  const unsigned short int *__ctype_b;
142  const int *__ctype_tolower;
143  const int *__ctype_toupper;
144  const char *__names[13];
145} *__locale_t;
146typedef __locale_t locale_t;
147extern size_t strftime_l (char *__restrict __s, size_t __maxsize,
148     __const char *__restrict __format,
149     __const struct tm *__restrict __tp,
150     __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__));
151
152extern struct tm *gmtime (__const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__));
153extern struct tm *localtime (__const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__));
154
155extern struct tm *gmtime_r (__const time_t *__restrict __timer,
156       struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__));
157extern struct tm *localtime_r (__const time_t *__restrict __timer,
158          struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__));
159
160extern char *asctime (__const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__));
161extern char *ctime (__const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__));
162
163extern char *asctime_r (__const struct tm *__restrict __tp,
164   char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__));
165extern char *ctime_r (__const time_t *__restrict __timer,
166        char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__));
167extern char *__tzname[2];
168extern int __daylight;
169extern long int __timezone;
170extern char *tzname[2];
171extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__));
172extern int daylight;
173extern long int timezone;
174extern int stime (__const time_t *__when) __attribute__ ((__nothrow__ , __leaf__));
175extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__));
176extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__));
177extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
178extern int nanosleep (__const struct timespec *__requested_time,
179        struct timespec *__remaining);
180extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__));
181extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__));
182extern int clock_settime (clockid_t __clock_id, __const struct timespec *__tp)
183     __attribute__ ((__nothrow__ , __leaf__));
184extern int clock_nanosleep (clockid_t __clock_id, int __flags,
185       __const struct timespec *__req,
186       struct timespec *__rem);
187extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__));
188extern int timer_create (clockid_t __clock_id,
189    struct sigevent *__restrict __evp,
190    timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__));
191extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__));
192extern int timer_settime (timer_t __timerid, int __flags,
193     __const struct itimerspec *__restrict __value,
194     struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__));
195extern int timer_gettime (timer_t __timerid, struct itimerspec *__value)
196     __attribute__ ((__nothrow__ , __leaf__));
197extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__));
198
199typedef unsigned long int pthread_t;
200typedef union
201{
202  char __size[56];
203  long int __align;
204} pthread_attr_t;
205typedef struct __pthread_internal_list
206{
207  struct __pthread_internal_list *__prev;
208  struct __pthread_internal_list *__next;
209} __pthread_list_t;
210typedef union
211{
212  struct __pthread_mutex_s
213  {
214    int __lock;
215    unsigned int __count;
216    int __owner;
217    unsigned int __nusers;
218    int __kind;
219    int __spins;
220    __pthread_list_t __list;
221  } __data;
222  char __size[40];
223  long int __align;
224} pthread_mutex_t;
225typedef union
226{
227  char __size[4];
228  int __align;
229} pthread_mutexattr_t;
230typedef union
231{
232  struct
233  {
234    int __lock;
235    unsigned int __futex;
236    __extension__ unsigned long long int __total_seq;
237    __extension__ unsigned long long int __wakeup_seq;
238    __extension__ unsigned long long int __woken_seq;
239    void *__mutex;
240    unsigned int __nwaiters;
241    unsigned int __broadcast_seq;
242  } __data;
243  char __size[48];
244  __extension__ long long int __align;
245} pthread_cond_t;
246typedef union
247{
248  char __size[4];
249  int __align;
250} pthread_condattr_t;
251typedef unsigned int pthread_key_t;
252typedef int pthread_once_t;
253typedef union
254{
255  struct
256  {
257    int __lock;
258    unsigned int __nr_readers;
259    unsigned int __readers_wakeup;
260    unsigned int __writer_wakeup;
261    unsigned int __nr_readers_queued;
262    unsigned int __nr_writers_queued;
263    int __writer;
264    int __shared;
265    unsigned long int __pad1;
266    unsigned long int __pad2;
267    unsigned int __flags;
268  } __data;
269  char __size[56];
270  long int __align;
271} pthread_rwlock_t;
272typedef union
273{
274  char __size[8];
275  long int __align;
276} pthread_rwlockattr_t;
277typedef volatile int pthread_spinlock_t;
278typedef union
279{
280  char __size[32];
281  long int __align;
282} pthread_barrier_t;
283typedef union
284{
285  char __size[4];
286  int __align;
287} pthread_barrierattr_t;
288typedef long int __jmp_buf[8];
289enum
290{
291  PTHREAD_CREATE_JOINABLE,
292  PTHREAD_CREATE_DETACHED
293};
294enum
295{
296  PTHREAD_MUTEX_TIMED_NP,
297  PTHREAD_MUTEX_RECURSIVE_NP,
298  PTHREAD_MUTEX_ERRORCHECK_NP,
299  PTHREAD_MUTEX_ADAPTIVE_NP
300  ,
301  PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_TIMED_NP,
302  PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP,
303  PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP,
304  PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL
305};
306enum
307{
308  PTHREAD_MUTEX_STALLED,
309  PTHREAD_MUTEX_STALLED_NP = PTHREAD_MUTEX_STALLED,
310  PTHREAD_MUTEX_ROBUST,
311  PTHREAD_MUTEX_ROBUST_NP = PTHREAD_MUTEX_ROBUST
312};
313enum
314{
315  PTHREAD_RWLOCK_PREFER_READER_NP,
316  PTHREAD_RWLOCK_PREFER_WRITER_NP,
317  PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP,
318  PTHREAD_RWLOCK_DEFAULT_NP = PTHREAD_RWLOCK_PREFER_READER_NP
319};
320enum
321{
322  PTHREAD_INHERIT_SCHED,
323  PTHREAD_EXPLICIT_SCHED
324};
325enum
326{
327  PTHREAD_SCOPE_SYSTEM,
328  PTHREAD_SCOPE_PROCESS
329};
330enum
331{
332  PTHREAD_PROCESS_PRIVATE,
333  PTHREAD_PROCESS_SHARED
334};
335struct _pthread_cleanup_buffer
336{
337  void (*__routine) (void *);
338  void *__arg;
339  int __canceltype;
340  struct _pthread_cleanup_buffer *__prev;
341};
342enum
343{
344  PTHREAD_CANCEL_ENABLE,
345  PTHREAD_CANCEL_DISABLE
346};
347enum
348{
349  PTHREAD_CANCEL_DEFERRED,
350  PTHREAD_CANCEL_ASYNCHRONOUS
351};
352
353extern int pthread_create (pthread_t *__restrict __newthread,
354      __const pthread_attr_t *__restrict __attr,
355      void *(*__start_routine) (void *),
356      void *__restrict __arg) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 3)));
357extern void pthread_exit (void *__retval) __attribute__ ((__noreturn__));
358extern int pthread_join (pthread_t __th, void **__thread_return);
359extern int pthread_detach (pthread_t __th) __attribute__ ((__nothrow__ , __leaf__));
360extern pthread_t pthread_self (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
361extern int pthread_equal (pthread_t __thread1, pthread_t __thread2) __attribute__ ((__nothrow__ , __leaf__));
362extern int pthread_attr_init (pthread_attr_t *__attr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
363extern int pthread_attr_destroy (pthread_attr_t *__attr)
364     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
365extern int pthread_attr_getdetachstate (__const pthread_attr_t *__attr,
366     int *__detachstate)
367     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
368extern int pthread_attr_setdetachstate (pthread_attr_t *__attr,
369     int __detachstate)
370     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
371extern int pthread_attr_getguardsize (__const pthread_attr_t *__attr,
372          size_t *__guardsize)
373     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
374extern int pthread_attr_setguardsize (pthread_attr_t *__attr,
375          size_t __guardsize)
376     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
377extern int pthread_attr_getschedparam (__const pthread_attr_t *__restrict
378           __attr,
379           struct sched_param *__restrict __param)
380     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
381extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr,
382           __const struct sched_param *__restrict
383           __param) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
384extern int pthread_attr_getschedpolicy (__const pthread_attr_t *__restrict
385     __attr, int *__restrict __policy)
386     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
387extern int pthread_attr_setschedpolicy (pthread_attr_t *__attr, int __policy)
388     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
389extern int pthread_attr_getinheritsched (__const pthread_attr_t *__restrict
390      __attr, int *__restrict __inherit)
391     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
392extern int pthread_attr_setinheritsched (pthread_attr_t *__attr,
393      int __inherit)
394     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
395extern int pthread_attr_getscope (__const pthread_attr_t *__restrict __attr,
396      int *__restrict __scope)
397     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
398extern int pthread_attr_setscope (pthread_attr_t *__attr, int __scope)
399     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
400extern int pthread_attr_getstackaddr (__const pthread_attr_t *__restrict
401          __attr, void **__restrict __stackaddr)
402     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) __attribute__ ((__deprecated__));
403extern int pthread_attr_setstackaddr (pthread_attr_t *__attr,
404          void *__stackaddr)
405     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__));
406extern int pthread_attr_getstacksize (__const pthread_attr_t *__restrict
407          __attr, size_t *__restrict __stacksize)
408     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
409extern int pthread_attr_setstacksize (pthread_attr_t *__attr,
410          size_t __stacksize)
411     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
412extern int pthread_attr_getstack (__const pthread_attr_t *__restrict __attr,
413      void **__restrict __stackaddr,
414      size_t *__restrict __stacksize)
415     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3)));
416extern int pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr,
417      size_t __stacksize) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
418extern int pthread_setschedparam (pthread_t __target_thread, int __policy,
419      __const struct sched_param *__param)
420     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3)));
421extern int pthread_getschedparam (pthread_t __target_thread,
422      int *__restrict __policy,
423      struct sched_param *__restrict __param)
424     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3)));
425extern int pthread_setschedprio (pthread_t __target_thread, int __prio)
426     __attribute__ ((__nothrow__ , __leaf__));
427extern int pthread_once (pthread_once_t *__once_control,
428    void (*__init_routine) (void)) __attribute__ ((__nonnull__ (1, 2)));
429extern int pthread_setcancelstate (int __state, int *__oldstate);
430extern int pthread_setcanceltype (int __type, int *__oldtype);
431extern int pthread_cancel (pthread_t __th);
432extern void pthread_testcancel (void);
433typedef struct
434{
435  struct
436  {
437    __jmp_buf __cancel_jmp_buf;
438    int __mask_was_saved;
439  } __cancel_jmp_buf[1];
440  void *__pad[4];
441} __pthread_unwind_buf_t __attribute__ ((__aligned__));
442struct __pthread_cleanup_frame
443{
444  void (*__cancel_routine) (void *);
445  void *__cancel_arg;
446  int __do_it;
447  int __cancel_type;
448};
449extern void __pthread_register_cancel (__pthread_unwind_buf_t *__buf)
450     ;
451extern void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf)
452  ;
453extern void __pthread_unwind_next (__pthread_unwind_buf_t *__buf)
454     __attribute__ ((__noreturn__))
455     __attribute__ ((__weak__))
456     ;
457struct __jmp_buf_tag;
458extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __attribute__ ((__nothrow__ , __leaf__));
459extern int pthread_mutex_init (pthread_mutex_t *__mutex,
460          __const pthread_mutexattr_t *__mutexattr)
461     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
462extern int pthread_mutex_destroy (pthread_mutex_t *__mutex)
463     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
464extern int pthread_mutex_trylock (pthread_mutex_t *__mutex)
465     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
466extern int pthread_mutex_lock (pthread_mutex_t *__mutex)
467     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
468extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
469        __const struct timespec *__restrict
470        __abstime) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
471extern int pthread_mutex_unlock (pthread_mutex_t *__mutex)
472     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
473extern int pthread_mutex_getprioceiling (__const pthread_mutex_t *
474      __restrict __mutex,
475      int *__restrict __prioceiling)
476     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
477extern int pthread_mutex_setprioceiling (pthread_mutex_t *__restrict __mutex,
478      int __prioceiling,
479      int *__restrict __old_ceiling)
480     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3)));
481extern int pthread_mutex_consistent (pthread_mutex_t *__mutex)
482     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
483extern int pthread_mutexattr_init (pthread_mutexattr_t *__attr)
484     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
485extern int pthread_mutexattr_destroy (pthread_mutexattr_t *__attr)
486     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
487extern int pthread_mutexattr_getpshared (__const pthread_mutexattr_t *
488      __restrict __attr,
489      int *__restrict __pshared)
490     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
491extern int pthread_mutexattr_setpshared (pthread_mutexattr_t *__attr,
492      int __pshared)
493     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
494extern int pthread_mutexattr_gettype (__const pthread_mutexattr_t *__restrict
495          __attr, int *__restrict __kind)
496     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
497extern int pthread_mutexattr_settype (pthread_mutexattr_t *__attr, int __kind)
498     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
499extern int pthread_mutexattr_getprotocol (__const pthread_mutexattr_t *
500       __restrict __attr,
501       int *__restrict __protocol)
502     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
503extern int pthread_mutexattr_setprotocol (pthread_mutexattr_t *__attr,
504       int __protocol)
505     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
506extern int pthread_mutexattr_getprioceiling (__const pthread_mutexattr_t *
507          __restrict __attr,
508          int *__restrict __prioceiling)
509     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
510extern int pthread_mutexattr_setprioceiling (pthread_mutexattr_t *__attr,
511          int __prioceiling)
512     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
513extern int pthread_mutexattr_getrobust (__const pthread_mutexattr_t *__attr,
514     int *__robustness)
515     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
516extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr,
517     int __robustness)
518     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
519extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock,
520    __const pthread_rwlockattr_t *__restrict
521    __attr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
522extern int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock)
523     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
524extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock)
525     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
526extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock)
527  __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
528extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,
529           __const struct timespec *__restrict
530           __abstime) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
531extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock)
532     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
533extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock)
534     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
535extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,
536           __const struct timespec *__restrict
537           __abstime) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
538extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock)
539     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
540extern int pthread_rwlockattr_init (pthread_rwlockattr_t *__attr)
541     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
542extern int pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr)
543     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
544extern int pthread_rwlockattr_getpshared (__const pthread_rwlockattr_t *
545       __restrict __attr,
546       int *__restrict __pshared)
547     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
548extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *__attr,
549       int __pshared)
550     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
551extern int pthread_rwlockattr_getkind_np (__const pthread_rwlockattr_t *
552       __restrict __attr,
553       int *__restrict __pref)
554     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
555extern int pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *__attr,
556       int __pref) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
557extern int pthread_cond_init (pthread_cond_t *__restrict __cond,
558         __const pthread_condattr_t *__restrict
559         __cond_attr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
560extern int pthread_cond_destroy (pthread_cond_t *__cond)
561     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
562extern int pthread_cond_signal (pthread_cond_t *__cond)
563     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
564extern int pthread_cond_broadcast (pthread_cond_t *__cond)
565     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
566extern int pthread_cond_wait (pthread_cond_t *__restrict __cond,
567         pthread_mutex_t *__restrict __mutex)
568     __attribute__ ((__nonnull__ (1, 2)));
569extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
570       pthread_mutex_t *__restrict __mutex,
571       __const struct timespec *__restrict
572       __abstime) __attribute__ ((__nonnull__ (1, 2, 3)));
573extern int pthread_condattr_init (pthread_condattr_t *__attr)
574     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
575extern int pthread_condattr_destroy (pthread_condattr_t *__attr)
576     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
577extern int pthread_condattr_getpshared (__const pthread_condattr_t *
578     __restrict __attr,
579     int *__restrict __pshared)
580     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
581extern int pthread_condattr_setpshared (pthread_condattr_t *__attr,
582     int __pshared) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
583extern int pthread_condattr_getclock (__const pthread_condattr_t *
584          __restrict __attr,
585          __clockid_t *__restrict __clock_id)
586     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
587extern int pthread_condattr_setclock (pthread_condattr_t *__attr,
588          __clockid_t __clock_id)
589     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
590extern int pthread_spin_init (pthread_spinlock_t *__lock, int __pshared)
591     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
592extern int pthread_spin_destroy (pthread_spinlock_t *__lock)
593     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
594extern int pthread_spin_lock (pthread_spinlock_t *__lock)
595     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
596extern int pthread_spin_trylock (pthread_spinlock_t *__lock)
597     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
598extern int pthread_spin_unlock (pthread_spinlock_t *__lock)
599     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
600extern int pthread_barrier_init (pthread_barrier_t *__restrict __barrier,
601     __const pthread_barrierattr_t *__restrict
602     __attr, unsigned int __count)
603     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
604extern int pthread_barrier_destroy (pthread_barrier_t *__barrier)
605     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
606extern int pthread_barrier_wait (pthread_barrier_t *__barrier)
607     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
608extern int pthread_barrierattr_init (pthread_barrierattr_t *__attr)
609     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
610extern int pthread_barrierattr_destroy (pthread_barrierattr_t *__attr)
611     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
612extern int pthread_barrierattr_getpshared (__const pthread_barrierattr_t *
613        __restrict __attr,
614        int *__restrict __pshared)
615     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
616extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr,
617        int __pshared)
618     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
619extern int pthread_key_create (pthread_key_t *__key,
620          void (*__destr_function) (void *))
621     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
622extern int pthread_key_delete (pthread_key_t __key) __attribute__ ((__nothrow__ , __leaf__));
623extern void *pthread_getspecific (pthread_key_t __key) __attribute__ ((__nothrow__ , __leaf__));
624extern int pthread_setspecific (pthread_key_t __key,
625    __const void *__pointer) __attribute__ ((__nothrow__ , __leaf__)) ;
626extern int pthread_getcpuclockid (pthread_t __thread_id,
627      __clockid_t *__clock_id)
628     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
629extern int pthread_atfork (void (*__prepare) (void),
630      void (*__parent) (void),
631      void (*__child) (void)) __attribute__ ((__nothrow__ , __leaf__));
632
633int i;
634pthread_mutex_t lock;
635inline int down_interruptible() {
636  pthread_mutex_lock(&lock);
637  return 0;
638}
639inline void up() {
640  pthread_mutex_unlock(&lock);
641  return;
642}
643inline int copy_to_user(int to, int from, int n) {
644  to = from;
645  return __VERIFIER_nondet_int();
646}
647inline int copy_from_user(int to, int from, int n) {
648  to = from;
649  return __VERIFIER_nondet_int();
650}
651inline int __get_user(int size, int ptr)
652{
653  return __VERIFIER_nondet_int();
654}
655inline int __put_user(int size, int ptr)
656{
657    return __VERIFIER_nondet_int();
658}
659int scull_quantum = 4000;
660int scull_qset = 1000;
661int dev_data;
662int dev_quantum;
663int dev_qset;
664int dev_size;
665int __X__;
666int scull_trim(int dev)
667{
668  int qset = dev_qset;
669  dev_size = 0;
670  dev_quantum = scull_quantum;
671  dev_qset = scull_qset;
672  dev_data = 0;
673  return 0;
674}
675inline int scull_open(int tid, int i, int filp)
676{
677  int dev;
678  dev = i;
679  filp = dev;
680  if (down_interruptible())
681    return -512;
682  __X__ = 2;
683  scull_trim(dev);
684  if (!(__X__ >= 2)) ERROR: goto ERROR;;
685  up();
686  return 0;
687}
688inline int scull_follow(int dev, int n) {
689  return __VERIFIER_nondet_int();
690}
691inline int scull_read(int tid, int filp, int buf, int count,
692     int f_pos)
693{
694  int dev = filp;
695  int dptr;
696  int quantum = dev_quantum, qset = dev_qset;
697  int itemsize = quantum * qset;
698  int item, s_pos, q_pos, rest;
699  int retval = 0;
700  if (down_interruptible())
701    return -512;
702  __X__ = 0;
703  if (f_pos >= dev_size)
704    goto out;
705  if (f_pos+count >= dev_size)
706    count = dev_size - f_pos;
707  item = f_pos / itemsize;
708  rest = f_pos;
709   s_pos = rest / quantum; q_pos = rest;
710   dptr = scull_follow(dev, item);
711   if (count > quantum - q_pos)
712     count = quantum - q_pos;
713  if (copy_to_user(buf, dev_data + s_pos + q_pos, count)) {
714    retval = -2;
715    goto out;
716  }
717  f_pos += count;
718  retval = count;
719  if (!(__X__ <= 0)) ERROR: goto ERROR;;
720 out:
721  up();
722  return retval;
723}
724inline int scull_write(int tid, int filp, int buf, int count,
725      int f_pos)
726{
727  int dev = filp;
728  int dptr;
729  int quantum = dev_quantum, qset = dev_qset;
730  int itemsize = quantum * qset;
731  int item, s_pos, q_pos, rest;
732  int retval = -4;
733  if (down_interruptible())
734    return -512;
735  item = f_pos / itemsize;
736  rest = f_pos;
737  s_pos = rest / quantum; q_pos = rest;
738  dptr = scull_follow(dev, item);
739  if (dptr == 0)
740    goto out;
741  if (count > quantum - q_pos)
742    count = quantum - q_pos;
743  __X__ = 1;
744  if (copy_from_user(dev_data+s_pos+q_pos, buf, count)) {
745    retval = -2;
746    goto out;
747  }
748  f_pos += count;
749  retval = count;
750  if (dev_size < f_pos)
751    dev_size = f_pos;
752  if (!(__X__ == 1)) ERROR: goto ERROR;;
753 out:
754  up();
755  return retval;
756}
757inline int scull_ioctl(int i, int filp,
758                 int cmd, int arg)
759{
760 int err = 0, tmp;
761 int retval = 0;
762 switch(cmd) {
763   case 0:
764  scull_quantum = 4000;
765  scull_qset = 1000;
766  break;
767   case 1:
768  retval = __get_user(scull_quantum, arg);
769  break;
770   case 3:
771  scull_quantum = arg;
772  break;
773   case 5:
774  retval = __put_user(scull_quantum, arg);
775  break;
776   case 7:
777  return scull_quantum;
778   case 9:
779  tmp = scull_quantum;
780  retval = __get_user(scull_quantum, arg);
781  if (retval == 0)
782   retval = __put_user(tmp, arg);
783  break;
784   case 11:
785  tmp = scull_quantum;
786  scull_quantum = arg;
787  return tmp;
788   case 2:
789  retval = __get_user(scull_qset, arg);
790  break;
791   case 4:
792  scull_qset = arg;
793  break;
794   case 6:
795  retval = __put_user(scull_qset, arg);
796  break;
797   case 8:
798  return scull_qset;
799   case 10:
800  tmp = scull_qset;
801  retval = __get_user(scull_qset, arg);
802  if (retval == 0)
803   retval = __put_user(tmp, arg);
804  break;
805   case 12:
806  tmp = scull_qset;
807  scull_qset = arg;
808  return tmp;
809   default:
810  return -25;
811 }
812 return retval;
813}
814inline int scull_llseek(int filp, int off, int whence, int f_pos)
815{
816  int dev = filp;
817  int newpos;
818  switch(whence) {
819  case 0:
820    newpos = off;
821    break;
822  case 1:
823    newpos = filp + f_pos + off;
824    break;
825  case 2:
826    newpos = dev_size + off;
827    break;
828  default:
829    return -28;
830  }
831  if (newpos < 0) return -28;
832  filp = newpos;
833  return newpos;
834}
835inline void scull_cleanup_module(void)
836{
837  int dev;
838  scull_trim(dev);
839}
840inline int scull_init_module()
841{
842  int result = 0;
843  return 0;
844 fail:
845  scull_cleanup_module();
846  return result;
847}
848void *loader() {
849  scull_init_module();
850  scull_cleanup_module();
851}
852void *thread1() {
853  int filp;
854  int buf;
855  int count = 10;
856  int off = 0;
857  scull_open(1, i, filp);
858  scull_read(1, filp, buf, count, off);
859  0;
860}
861void *thread2() {
862  int filp;
863  int buf;
864  int count = 10;
865  int off = 0;
866  scull_open(2, i, filp);
867  scull_write(2, filp, buf, count, off);
868  0;
869}
870int main() {
871  pthread_t t1, t2, t3;
872  pthread_mutex_init(&lock, 0);
873  pthread_create(&t1, 0, loader, 0);
874  pthread_create(&t2, 0, thread1, 0);
875  pthread_create(&t3, 0, thread2, 0);
876  pthread_join(t1, 0);
877  pthread_join(t2, 0);
878  pthread_join(t3, 0);
879  pthread_mutex_destroy(&lock);
880  return 0;
881}