Showing error 10

User: Jiri Slaby
Error type: Reachable Error Location
Error type description: A specified error location is reachable in some program path
File location: pthread/reorder_5_BUG.cil.c
Line in file: 606
Project: SV-COMP 2012
Tools: Manual Work
Entered: 2012-11-19 13:47:39 UTC


Source:

  1/* Generated by CIL v. 1.3.7 */
  2/* print_CIL_Input is true */
  3
  4#line 214 "/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stddef.h"
  5typedef unsigned long size_t;
  6#line 144 "/usr/include/bits/types.h"
  7typedef long __off_t;
  8#line 145 "/usr/include/bits/types.h"
  9typedef long __off64_t;
 10#line 46 "/usr/include/stdio.h"
 11struct _IO_FILE;
 12#line 46 "/usr/include/stdio.h"
 13typedef struct _IO_FILE FILE;
 14#line 167 "/usr/include/libio.h"
 15struct _IO_FILE;
 16#line 177 "/usr/include/libio.h"
 17typedef void _IO_lock_t;
 18#line 183 "/usr/include/libio.h"
 19struct _IO_marker {
 20   struct _IO_marker *_next ;
 21   struct _IO_FILE *_sbuf ;
 22   int _pos ;
 23};
 24#line 268 "/usr/include/libio.h"
 25struct _IO_FILE {
 26   int _flags ;
 27   char *_IO_read_ptr ;
 28   char *_IO_read_end ;
 29   char *_IO_read_base ;
 30   char *_IO_write_base ;
 31   char *_IO_write_ptr ;
 32   char *_IO_write_end ;
 33   char *_IO_buf_base ;
 34   char *_IO_buf_end ;
 35   char *_IO_save_base ;
 36   char *_IO_backup_base ;
 37   char *_IO_save_end ;
 38   struct _IO_marker *_markers ;
 39   struct _IO_FILE *_chain ;
 40   int _fileno ;
 41   int _flags2 ;
 42   __off_t _old_offset ;
 43   unsigned short _cur_column ;
 44   signed char _vtable_offset ;
 45   char _shortbuf[1] ;
 46   _IO_lock_t *_lock ;
 47   __off64_t _offset ;
 48   void *__pad1 ;
 49   void *__pad2 ;
 50   void *__pad3 ;
 51   void *__pad4 ;
 52   size_t __pad5 ;
 53   int _mode ;
 54   char _unused2[(15U * sizeof(int ) - 4U * sizeof(void *)) - sizeof(size_t )] ;
 55};
 56#line 50 "/usr/include/bits/pthreadtypes.h"
 57typedef unsigned long pthread_t;
 58#line 53 "/usr/include/bits/pthreadtypes.h"
 59union __anonunion_pthread_attr_t_14 {
 60   char __size[56] ;
 61   long __align ;
 62};
 63#line 53 "/usr/include/bits/pthreadtypes.h"
 64typedef union __anonunion_pthread_attr_t_14 pthread_attr_t;
 65#line 1 "<compiler builtins>"
 66void *__builtin_alloca(unsigned int  ) ;
 67#line 144 "/usr/include/stdio.h"
 68extern struct _IO_FILE *stderr ;
 69#line 327
 70extern int fprintf(FILE * __restrict  __stream , char const   * __restrict  __format 
 71                   , ...) ;
 72#line 407
 73extern  __attribute__((__nothrow__)) int sscanf(char const   * __restrict  __s , char const   * __restrict  __format 
 74                                                , ...) ;
 75#line 30 "/usr/include/sys/sysmacros.h"
 76__inline extern  __attribute__((__nothrow__)) unsigned int gnu_dev_major(unsigned long long __dev ) ;
 77#line 33
 78__inline extern  __attribute__((__nothrow__)) unsigned int gnu_dev_minor(unsigned long long __dev ) ;
 79#line 36
 80__inline extern  __attribute__((__nothrow__)) unsigned long long gnu_dev_makedev(unsigned int __major ,
 81                                                                                 unsigned int __minor ) ;
 82#line 41
 83__inline extern  __attribute__((__nothrow__)) unsigned int gnu_dev_major(unsigned long long __dev ) ;
 84#line 41 "/usr/include/sys/sysmacros.h"
 85__inline extern unsigned int gnu_dev_major(unsigned long long __dev ) 
 86{ unsigned long long __cil_tmp2 ;
 87  unsigned int __cil_tmp3 ;
 88  unsigned int __cil_tmp4 ;
 89  unsigned long long __cil_tmp5 ;
 90  unsigned long long __cil_tmp6 ;
 91  unsigned long long __cil_tmp7 ;
 92  unsigned long long __cil_tmp8 ;
 93
 94  {
 95  {
 96#line 44
 97  __cil_tmp2 = __dev >> 32;
 98#line 44
 99  __cil_tmp3 = (unsigned int )__cil_tmp2;
100#line 44
101  __cil_tmp4 = __cil_tmp3 & 4294963200U;
102#line 44
103  __cil_tmp5 = (unsigned long long )__cil_tmp4;
104#line 44
105  __cil_tmp6 = __dev >> 8;
106#line 44
107  __cil_tmp7 = __cil_tmp6 & 4095ULL;
108#line 44
109  __cil_tmp8 = __cil_tmp7 | __cil_tmp5;
110#line 44
111  return ((unsigned int )__cil_tmp8);
112  }
113}
114}
115#line 47
116__inline extern  __attribute__((__nothrow__)) unsigned int gnu_dev_minor(unsigned long long __dev ) ;
117#line 47 "/usr/include/sys/sysmacros.h"
118__inline extern unsigned int gnu_dev_minor(unsigned long long __dev ) 
119{ unsigned long long __cil_tmp2 ;
120  unsigned int __cil_tmp3 ;
121  unsigned int __cil_tmp4 ;
122  unsigned long long __cil_tmp5 ;
123  unsigned long long __cil_tmp6 ;
124  unsigned long long __cil_tmp7 ;
125
126  {
127  {
128#line 50
129  __cil_tmp2 = __dev >> 12;
130#line 50
131  __cil_tmp3 = (unsigned int )__cil_tmp2;
132#line 50
133  __cil_tmp4 = __cil_tmp3 & 4294967040U;
134#line 50
135  __cil_tmp5 = (unsigned long long )__cil_tmp4;
136#line 50
137  __cil_tmp6 = __dev & 255ULL;
138#line 50
139  __cil_tmp7 = __cil_tmp6 | __cil_tmp5;
140#line 50
141  return ((unsigned int )__cil_tmp7);
142  }
143}
144}
145#line 53
146__inline extern  __attribute__((__nothrow__)) unsigned long long gnu_dev_makedev(unsigned int __major ,
147                                                                                 unsigned int __minor ) ;
148#line 53 "/usr/include/sys/sysmacros.h"
149__inline extern unsigned long long gnu_dev_makedev(unsigned int __major , unsigned int __minor ) 
150{ unsigned int __cil_tmp3 ;
151  unsigned long long __cil_tmp4 ;
152  unsigned long long __cil_tmp5 ;
153  unsigned int __cil_tmp6 ;
154  unsigned long long __cil_tmp7 ;
155  unsigned long long __cil_tmp8 ;
156  unsigned int __cil_tmp9 ;
157  unsigned int __cil_tmp10 ;
158  unsigned int __cil_tmp11 ;
159  unsigned int __cil_tmp12 ;
160  unsigned long long __cil_tmp13 ;
161  unsigned long long __cil_tmp14 ;
162
163  {
164  {
165#line 56
166  __cil_tmp3 = __major & 4294963200U;
167#line 56
168  __cil_tmp4 = (unsigned long long )__cil_tmp3;
169#line 56
170  __cil_tmp5 = __cil_tmp4 << 32;
171#line 56
172  __cil_tmp6 = __minor & 4294967040U;
173#line 56
174  __cil_tmp7 = (unsigned long long )__cil_tmp6;
175#line 56
176  __cil_tmp8 = __cil_tmp7 << 12;
177#line 56
178  __cil_tmp9 = __major & 4095U;
179#line 56
180  __cil_tmp10 = __cil_tmp9 << 8;
181#line 56
182  __cil_tmp11 = __minor & 255U;
183#line 56
184  __cil_tmp12 = __cil_tmp11 | __cil_tmp10;
185#line 56
186  __cil_tmp13 = (unsigned long long )__cil_tmp12;
187#line 56
188  __cil_tmp14 = __cil_tmp13 | __cil_tmp8;
189#line 56
190  return (__cil_tmp14 | __cil_tmp5);
191  }
192}
193}
194#line 646 "/usr/include/stdlib.h"
195extern  __attribute__((__nothrow__, __noreturn__)) void exit(int __status ) ;
196#line 221 "/usr/include/pthread.h"
197extern  __attribute__((__nothrow__)) int pthread_create(pthread_t * __restrict  __newthread ,
198                                                        pthread_attr_t const   * __restrict  __attr ,
199                                                        void *(*__start_routine)(void * ) ,
200                                                        void * __restrict  __arg )  __attribute__((__nonnull__(1,3))) ;
201#line 238
202extern int pthread_join(pthread_t __th , void **__thread_return ) ;
203#line 7 "reorder_bad.c"
204static int iSet  =    4;
205#line 8 "reorder_bad.c"
206static int iCheck  =    1;
207#line 10 "reorder_bad.c"
208static int a  =    0;
209#line 11 "reorder_bad.c"
210static int b  =    0;
211#line 15
212void *setThread(void *param ) ;
213#line 16
214void *checkThread(void *param ) ;
215#line 20 "reorder_bad.c"
216int main(int argc , char **argv ) 
217{ int i ;
218  int err ;
219  pthread_t *setPool ;
220  unsigned int __lengthofsetPool ;
221  void *tmp ;
222  pthread_t *checkPool ;
223  unsigned int __lengthofcheckPool ;
224  void *tmp___0 ;
225  FILE * __restrict  __cil_tmp11 ;
226  char const   * __restrict  __cil_tmp12 ;
227  char **__cil_tmp13 ;
228  char *__cil_tmp14 ;
229  char const   * __restrict  __cil_tmp15 ;
230  char const   * __restrict  __cil_tmp16 ;
231  char **__cil_tmp17 ;
232  char *__cil_tmp18 ;
233  char const   * __restrict  __cil_tmp19 ;
234  char const   * __restrict  __cil_tmp20 ;
235  int *__cil_tmp21 ;
236  int __cil_tmp22 ;
237  unsigned int __cil_tmp23 ;
238  int *__cil_tmp24 ;
239  int __cil_tmp25 ;
240  unsigned int __cil_tmp26 ;
241  int *__cil_tmp27 ;
242  int __cil_tmp28 ;
243  pthread_t *__cil_tmp29 ;
244  pthread_t * __restrict  __cil_tmp30 ;
245  void *__cil_tmp31 ;
246  pthread_attr_t const   * __restrict  __cil_tmp32 ;
247  void *__cil_tmp33 ;
248  void * __restrict  __cil_tmp34 ;
249  FILE * __restrict  __cil_tmp35 ;
250  char const   * __restrict  __cil_tmp36 ;
251  int *__cil_tmp37 ;
252  int __cil_tmp38 ;
253  pthread_t *__cil_tmp39 ;
254  pthread_t * __restrict  __cil_tmp40 ;
255  void *__cil_tmp41 ;
256  pthread_attr_t const   * __restrict  __cil_tmp42 ;
257  void *__cil_tmp43 ;
258  void * __restrict  __cil_tmp44 ;
259  FILE * __restrict  __cil_tmp45 ;
260  char const   * __restrict  __cil_tmp46 ;
261  int *__cil_tmp47 ;
262  int __cil_tmp48 ;
263  pthread_t *__cil_tmp49 ;
264  pthread_t __cil_tmp50 ;
265  void *__cil_tmp51 ;
266  void **__cil_tmp52 ;
267  FILE * __restrict  __cil_tmp53 ;
268  char const   * __restrict  __cil_tmp54 ;
269  int *__cil_tmp55 ;
270  int __cil_tmp56 ;
271  pthread_t *__cil_tmp57 ;
272  pthread_t __cil_tmp58 ;
273  void *__cil_tmp59 ;
274  void **__cil_tmp60 ;
275  FILE * __restrict  __cil_tmp61 ;
276  char const   * __restrict  __cil_tmp62 ;
277
278  {
279#line 23
280  if (argc != 1) {
281#line 24
282    if (argc != 3) {
283      {
284#line 25
285      __cil_tmp11 = (FILE * __restrict  )stderr;
286#line 25
287      __cil_tmp12 = (char const   * __restrict  )"./reorder <param1> <param2>\n";
288#line 25
289      fprintf(__cil_tmp11, __cil_tmp12);
290#line 26
291      exit(-1);
292      }
293    } else {
294      {
295#line 28
296      __cil_tmp13 = argv + 1;
297#line 28
298      __cil_tmp14 = *__cil_tmp13;
299#line 28
300      __cil_tmp15 = (char const   * __restrict  )__cil_tmp14;
301#line 28
302      __cil_tmp16 = (char const   * __restrict  )"%d";
303#line 28
304      sscanf(__cil_tmp15, __cil_tmp16, & iSet);
305#line 29
306      __cil_tmp17 = argv + 2;
307#line 29
308      __cil_tmp18 = *__cil_tmp17;
309#line 29
310      __cil_tmp19 = (char const   * __restrict  )__cil_tmp18;
311#line 29
312      __cil_tmp20 = (char const   * __restrict  )"%d";
313#line 29
314      sscanf(__cil_tmp19, __cil_tmp20, & iCheck);
315      }
316    }
317  } else {
318
319  }
320  {
321#line 35
322  __cil_tmp21 = & iSet;
323#line 35
324  __cil_tmp22 = *__cil_tmp21;
325#line 35
326  __lengthofsetPool = (unsigned int )__cil_tmp22;
327#line 35
328  __cil_tmp23 = 4U * __lengthofsetPool;
329#line 35
330  tmp = __builtin_alloca(__cil_tmp23);
331#line 35
332  setPool = (pthread_t *)tmp;
333#line 36
334  __cil_tmp24 = & iCheck;
335#line 36
336  __cil_tmp25 = *__cil_tmp24;
337#line 36
338  __lengthofcheckPool = (unsigned int )__cil_tmp25;
339#line 36
340  __cil_tmp26 = 4U * __lengthofcheckPool;
341#line 36
342  tmp___0 = __builtin_alloca(__cil_tmp26);
343#line 36
344  checkPool = (pthread_t *)tmp___0;
345#line 38
346  i = 0;
347  }
348  {
349#line 38
350  while (1) {
351    while_0_continue: /* CIL Label */ ;
352    {
353#line 38
354    __cil_tmp27 = & iSet;
355#line 38
356    __cil_tmp28 = *__cil_tmp27;
357#line 38
358    if (i < __cil_tmp28) {
359
360    } else {
361      goto while_0_break;
362    }
363    }
364    {
365#line 39
366    __cil_tmp29 = setPool + i;
367#line 39
368    __cil_tmp30 = (pthread_t * __restrict  )__cil_tmp29;
369#line 39
370    __cil_tmp31 = (void *)0;
371#line 39
372    __cil_tmp32 = (pthread_attr_t const   * __restrict  )__cil_tmp31;
373#line 39
374    __cil_tmp33 = (void *)0;
375#line 39
376    __cil_tmp34 = (void * __restrict  )__cil_tmp33;
377#line 39
378    err = pthread_create(__cil_tmp30, __cil_tmp32, & setThread, __cil_tmp34);
379    }
380#line 39
381    if (0 != err) {
382      {
383#line 40
384      __cil_tmp35 = (FILE * __restrict  )stderr;
385#line 40
386      __cil_tmp36 = (char const   * __restrict  )"Error [%d] found creating set thread.\n";
387#line 40
388      fprintf(__cil_tmp35, __cil_tmp36, err);
389#line 41
390      exit(-1);
391      }
392    } else {
393
394    }
395#line 38
396    i = i + 1;
397  }
398  while_0_break: /* CIL Label */ ;
399  }
400#line 45
401  i = 0;
402  {
403#line 45
404  while (1) {
405    while_1_continue: /* CIL Label */ ;
406    {
407#line 45
408    __cil_tmp37 = & iCheck;
409#line 45
410    __cil_tmp38 = *__cil_tmp37;
411#line 45
412    if (i < __cil_tmp38) {
413
414    } else {
415      goto while_1_break;
416    }
417    }
418    {
419#line 46
420    __cil_tmp39 = checkPool + i;
421#line 46
422    __cil_tmp40 = (pthread_t * __restrict  )__cil_tmp39;
423#line 46
424    __cil_tmp41 = (void *)0;
425#line 46
426    __cil_tmp42 = (pthread_attr_t const   * __restrict  )__cil_tmp41;
427#line 46
428    __cil_tmp43 = (void *)0;
429#line 46
430    __cil_tmp44 = (void * __restrict  )__cil_tmp43;
431#line 46
432    err = pthread_create(__cil_tmp40, __cil_tmp42, & checkThread, __cil_tmp44);
433    }
434#line 46
435    if (0 != err) {
436      {
437#line 48
438      __cil_tmp45 = (FILE * __restrict  )stderr;
439#line 48
440      __cil_tmp46 = (char const   * __restrict  )"Error [%d] found creating check thread.\n";
441#line 48
442      fprintf(__cil_tmp45, __cil_tmp46, err);
443#line 49
444      exit(-1);
445      }
446    } else {
447
448    }
449#line 45
450    i = i + 1;
451  }
452  while_1_break: /* CIL Label */ ;
453  }
454#line 53
455  i = 0;
456  {
457#line 53
458  while (1) {
459    while_2_continue: /* CIL Label */ ;
460    {
461#line 53
462    __cil_tmp47 = & iSet;
463#line 53
464    __cil_tmp48 = *__cil_tmp47;
465#line 53
466    if (i < __cil_tmp48) {
467
468    } else {
469      goto while_2_break;
470    }
471    }
472    {
473#line 54
474    __cil_tmp49 = setPool + i;
475#line 54
476    __cil_tmp50 = *__cil_tmp49;
477#line 54
478    __cil_tmp51 = (void *)0;
479#line 54
480    __cil_tmp52 = (void **)__cil_tmp51;
481#line 54
482    err = pthread_join(__cil_tmp50, __cil_tmp52);
483    }
484#line 54
485    if (0 != err) {
486      {
487#line 55
488      __cil_tmp53 = (FILE * __restrict  )stderr;
489#line 55
490      __cil_tmp54 = (char const   * __restrict  )"pthread join error: %d\n";
491#line 55
492      fprintf(__cil_tmp53, __cil_tmp54, err);
493#line 56
494      exit(-1);
495      }
496    } else {
497
498    }
499#line 53
500    i = i + 1;
501  }
502  while_2_break: /* CIL Label */ ;
503  }
504#line 60
505  i = 0;
506  {
507#line 60
508  while (1) {
509    while_3_continue: /* CIL Label */ ;
510    {
511#line 60
512    __cil_tmp55 = & iCheck;
513#line 60
514    __cil_tmp56 = *__cil_tmp55;
515#line 60
516    if (i < __cil_tmp56) {
517
518    } else {
519      goto while_3_break;
520    }
521    }
522    {
523#line 61
524    __cil_tmp57 = checkPool + i;
525#line 61
526    __cil_tmp58 = *__cil_tmp57;
527#line 61
528    __cil_tmp59 = (void *)0;
529#line 61
530    __cil_tmp60 = (void **)__cil_tmp59;
531#line 61
532    err = pthread_join(__cil_tmp58, __cil_tmp60);
533    }
534#line 61
535    if (0 != err) {
536      {
537#line 62
538      __cil_tmp61 = (FILE * __restrict  )stderr;
539#line 62
540      __cil_tmp62 = (char const   * __restrict  )"pthread join error: %d\n";
541#line 62
542      fprintf(__cil_tmp61, __cil_tmp62, err);
543#line 63
544      exit(-1);
545      }
546    } else {
547
548    }
549#line 60
550    i = i + 1;
551  }
552  while_3_break: /* CIL Label */ ;
553  }
554#line 67
555  return (0);
556}
557}
558#line 70 "reorder_bad.c"
559void *setThread(void *param ) 
560{ 
561
562  {
563#line 71
564  a = 1;
565#line 72
566  b = -1;
567#line 74
568  return ((void *)0);
569}
570}
571#line 77 "reorder_bad.c"
572void *checkThread(void *param ) 
573{ FILE * __restrict  __cil_tmp2 ;
574  char const   * __restrict  __cil_tmp3 ;
575
576  {
577#line 78
578  if (a == 0) {
579#line 78
580    if (b == 0) {
581
582    } else {
583      goto _L___0;
584    }
585  } else {
586    _L___0: /* CIL Label */ 
587#line 78
588    if (a == 1) {
589#line 78
590      if (b == -1) {
591
592      } else {
593        goto _L;
594      }
595    } else {
596      _L: /* CIL Label */ 
597      {
598#line 79
599      __cil_tmp2 = (FILE * __restrict  )stderr;
600#line 79
601      __cil_tmp3 = (char const   * __restrict  )"Bug found!\n";
602#line 79
603      fprintf(__cil_tmp2, __cil_tmp3);
604      }
605      goto ERROR;
606      ERROR: ;
607    }
608  }
609#line 86
610  return ((void *)0);
611}
612}