Showing error 57

User: Jiri Slaby
Error type: Reachable Error Location
Error type description: A specified error location is reachable in some program path
File location: heap-manipulation/merge_sort_safe.cil.c
Line in file: 29
Project: SV-COMP 2013
Project version: 2.6.28
Tools: Manual Work
Entered: 2013-01-17 16:57:54 UTC


Source:

  1/* Generated by CIL v. 1.3.7 */
  2/* print_CIL_Input is true */
  3
  4#line 211 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include/stddef.h"
  5typedef unsigned int size_t;
  6#line 15 "test-0177.c"
  7struct node {
  8   struct node *next ;
  9   int value ;
 10};
 11#line 20 "test-0177.c"
 12struct list {
 13   struct node *slist ;
 14   struct list *next ;
 15};
 16#line 471 "/usr/include/stdlib.h"
 17extern  __attribute__((__nothrow__)) void *malloc(size_t __size )  __attribute__((__malloc__)) ;
 18#line 488
 19extern  __attribute__((__nothrow__)) void free(void *__ptr ) ;
 20#line 514
 21extern  __attribute__((__nothrow__, __noreturn__)) void abort(void) ;
 22#line 3 "test-0177.c"
 23extern int __VERIFIER_nondet_int(void) ;
 24#line 5 "test-0177.c"
 25static void fail(void) 
 26{ 
 27
 28  {
 29  ERROR: 
 30  goto ERROR;
 31}
 32}
 33#line 25 "test-0177.c"
 34static void merge_single_node(struct node ***dst , struct node **data ) 
 35{ struct node *node ;
 36  void *__cil_tmp4 ;
 37  struct node **__cil_tmp5 ;
 38
 39  {
 40#line 29
 41  node = *data;
 42#line 30
 43  *data = *((struct node **)node);
 44#line 31
 45  __cil_tmp4 = (void *)0;
 46#line 31
 47  *((struct node **)node) = (struct node *)__cil_tmp4;
 48#line 34
 49  __cil_tmp5 = *dst;
 50#line 34
 51  *__cil_tmp5 = node;
 52#line 35
 53  *dst = (struct node **)node;
 54#line 36
 55  return;
 56}
 57}
 58#line 38 "test-0177.c"
 59static void merge_pair(struct node **dst , struct node *sub1 , struct node *sub2 ) 
 60{ struct node **__cil_tmp4 ;
 61  struct node **__cil_tmp5 ;
 62  struct node **__cil_tmp6 ;
 63  struct node *__cil_tmp7 ;
 64  struct node **__cil_tmp8 ;
 65  struct node **__cil_tmp9 ;
 66  struct node *__cil_tmp10 ;
 67  unsigned int __cil_tmp11 ;
 68  unsigned int __cil_tmp12 ;
 69  int __cil_tmp13 ;
 70  struct node **__cil_tmp14 ;
 71  struct node *__cil_tmp15 ;
 72  unsigned int __cil_tmp16 ;
 73  unsigned int __cil_tmp17 ;
 74  int __cil_tmp18 ;
 75
 76  {
 77  {
 78#line 43
 79  while (1) {
 80    while_0_continue: /* CIL Label */ ;
 81    {
 82#line 43
 83    __cil_tmp4 = & sub1;
 84#line 43
 85    if (*__cil_tmp4) {
 86
 87    } else {
 88      {
 89#line 43
 90      __cil_tmp5 = & sub2;
 91#line 43
 92      if (*__cil_tmp5) {
 93
 94      } else {
 95        goto while_0_break;
 96      }
 97      }
 98    }
 99    }
100    {
101#line 44
102    __cil_tmp6 = & sub2;
103#line 44
104    __cil_tmp7 = *__cil_tmp6;
105#line 44
106    if (! __cil_tmp7) {
107      {
108#line 45
109      merge_single_node(& dst, & sub1);
110      }
111    } else {
112      {
113#line 44
114      __cil_tmp8 = & sub1;
115#line 44
116      if (*__cil_tmp8) {
117        {
118#line 44
119        __cil_tmp9 = & sub2;
120#line 44
121        __cil_tmp10 = *__cil_tmp9;
122#line 44
123        __cil_tmp11 = (unsigned int )__cil_tmp10;
124#line 44
125        __cil_tmp12 = __cil_tmp11 + 4;
126#line 44
127        __cil_tmp13 = *((int *)__cil_tmp12);
128#line 44
129        __cil_tmp14 = & sub1;
130#line 44
131        __cil_tmp15 = *__cil_tmp14;
132#line 44
133        __cil_tmp16 = (unsigned int )__cil_tmp15;
134#line 44
135        __cil_tmp17 = __cil_tmp16 + 4;
136#line 44
137        __cil_tmp18 = *((int *)__cil_tmp17);
138#line 44
139        if (__cil_tmp18 < __cil_tmp13) {
140          {
141#line 45
142          merge_single_node(& dst, & sub1);
143          }
144        } else {
145          {
146#line 47
147          merge_single_node(& dst, & sub2);
148          }
149        }
150        }
151      } else {
152        {
153#line 47
154        merge_single_node(& dst, & sub2);
155        }
156      }
157      }
158    }
159    }
160  }
161  while_0_break: /* CIL Label */ ;
162  }
163#line 49
164  return;
165}
166}
167#line 51 "test-0177.c"
168static struct list *seq_sort_core(struct list *data ) 
169{ struct list *dst ;
170  struct list *next ;
171  void *__cil_tmp4 ;
172  unsigned int __cil_tmp5 ;
173  unsigned int __cil_tmp6 ;
174  unsigned int __cil_tmp7 ;
175  unsigned int __cil_tmp8 ;
176  struct node **__cil_tmp9 ;
177  struct node *__cil_tmp10 ;
178  struct node *__cil_tmp11 ;
179  unsigned int __cil_tmp12 ;
180  unsigned int __cil_tmp13 ;
181  unsigned int __cil_tmp14 ;
182  unsigned int __cil_tmp15 ;
183  void *__cil_tmp16 ;
184
185  {
186#line 53
187  __cil_tmp4 = (void *)0;
188#line 53
189  dst = (struct list *)__cil_tmp4;
190  {
191#line 55
192  while (1) {
193    while_1_continue: /* CIL Label */ ;
194#line 55
195    if (data) {
196
197    } else {
198      goto while_1_break;
199    }
200#line 56
201    __cil_tmp5 = (unsigned int )data;
202#line 56
203    __cil_tmp6 = __cil_tmp5 + 4;
204#line 56
205    next = *((struct list **)__cil_tmp6);
206#line 57
207    if (! next) {
208#line 59
209      __cil_tmp7 = (unsigned int )data;
210#line 59
211      __cil_tmp8 = __cil_tmp7 + 4;
212#line 59
213      *((struct list **)__cil_tmp8) = dst;
214#line 60
215      dst = data;
216      goto while_1_break;
217    } else {
218
219    }
220    {
221#line 65
222    __cil_tmp9 = (struct node **)data;
223#line 65
224    __cil_tmp10 = *((struct node **)data);
225#line 65
226    __cil_tmp11 = *((struct node **)next);
227#line 65
228    merge_pair(__cil_tmp9, __cil_tmp10, __cil_tmp11);
229#line 66
230    __cil_tmp12 = (unsigned int )data;
231#line 66
232    __cil_tmp13 = __cil_tmp12 + 4;
233#line 66
234    *((struct list **)__cil_tmp13) = dst;
235#line 67
236    dst = data;
237#line 70
238    __cil_tmp14 = (unsigned int )next;
239#line 70
240    __cil_tmp15 = __cil_tmp14 + 4;
241#line 70
242    data = *((struct list **)__cil_tmp15);
243#line 71
244    __cil_tmp16 = (void *)next;
245#line 71
246    free(__cil_tmp16);
247    }
248  }
249  while_1_break: /* CIL Label */ ;
250  }
251#line 74
252  return (dst);
253}
254}
255#line 77 "test-0177.c"
256static void inspect_before(struct list *shape ) 
257{ unsigned int __cil_tmp2 ;
258  unsigned int __cil_tmp3 ;
259  unsigned int __cil_tmp4 ;
260  unsigned int __cil_tmp5 ;
261  struct list *__cil_tmp6 ;
262  struct node *__cil_tmp7 ;
263  void *__cil_tmp8 ;
264  unsigned int __cil_tmp9 ;
265  struct node *__cil_tmp10 ;
266  struct node *__cil_tmp11 ;
267  unsigned int __cil_tmp12 ;
268  int __cil_tmp13 ;
269  unsigned int __cil_tmp14 ;
270  unsigned int __cil_tmp15 ;
271  void *__cil_tmp16 ;
272  unsigned int __cil_tmp17 ;
273  unsigned int __cil_tmp18 ;
274  unsigned int __cil_tmp19 ;
275  struct list *__cil_tmp20 ;
276  unsigned int __cil_tmp21 ;
277  int __cil_tmp22 ;
278  struct node *__cil_tmp23 ;
279  void *__cil_tmp24 ;
280  unsigned int __cil_tmp25 ;
281  struct node *__cil_tmp26 ;
282  struct node *__cil_tmp27 ;
283  unsigned int __cil_tmp28 ;
284  int __cil_tmp29 ;
285
286  {
287  {
288#line 80
289  while (1) {
290    while_2_continue: /* CIL Label */ ;
291#line 80
292    if (! shape) {
293      {
294#line 80
295      fail();
296      }
297    } else {
298
299    }
300    goto while_2_break;
301  }
302  while_2_break: /* CIL Label */ ;
303  }
304  {
305#line 82
306  while (1) {
307    while_3_continue: /* CIL Label */ ;
308    {
309#line 82
310    __cil_tmp2 = (unsigned int )shape;
311#line 82
312    __cil_tmp3 = __cil_tmp2 + 4;
313#line 82
314    if (*((struct list **)__cil_tmp3)) {
315
316    } else {
317      goto while_3_break;
318    }
319    }
320    {
321#line 83
322    while (1) {
323      while_4_continue: /* CIL Label */ ;
324#line 83
325      if (! shape) {
326        {
327#line 83
328        fail();
329        }
330      } else {
331
332      }
333      goto while_4_break;
334    }
335    while_4_break: /* CIL Label */ ;
336    }
337    {
338#line 84
339    while (1) {
340      while_5_continue: /* CIL Label */ ;
341      {
342#line 84
343      __cil_tmp4 = (unsigned int )shape;
344#line 84
345      __cil_tmp5 = __cil_tmp4 + 4;
346#line 84
347      __cil_tmp6 = *((struct list **)__cil_tmp5);
348#line 84
349      if (! __cil_tmp6) {
350        {
351#line 84
352        fail();
353        }
354      } else {
355
356      }
357      }
358      goto while_5_break;
359    }
360    while_5_break: /* CIL Label */ ;
361    }
362    {
363#line 85
364    while (1) {
365      while_6_continue: /* CIL Label */ ;
366      {
367#line 85
368      __cil_tmp7 = *((struct node **)shape);
369#line 85
370      if (! __cil_tmp7) {
371        {
372#line 85
373        fail();
374        }
375      } else {
376
377      }
378      }
379      goto while_6_break;
380    }
381    while_6_break: /* CIL Label */ ;
382    }
383    {
384#line 86
385    while (1) {
386      while_7_continue: /* CIL Label */ ;
387      {
388#line 86
389      __cil_tmp8 = (void *)0;
390#line 86
391      __cil_tmp9 = (unsigned int )__cil_tmp8;
392#line 86
393      __cil_tmp10 = *((struct node **)shape);
394#line 86
395      __cil_tmp11 = *((struct node **)__cil_tmp10);
396#line 86
397      __cil_tmp12 = (unsigned int )__cil_tmp11;
398#line 86
399      __cil_tmp13 = __cil_tmp12 == __cil_tmp9;
400#line 86
401      if (! __cil_tmp13) {
402        {
403#line 86
404        fail();
405        }
406      } else {
407
408      }
409      }
410      goto while_7_break;
411    }
412    while_7_break: /* CIL Label */ ;
413    }
414#line 82
415    __cil_tmp14 = (unsigned int )shape;
416#line 82
417    __cil_tmp15 = __cil_tmp14 + 4;
418#line 82
419    shape = *((struct list **)__cil_tmp15);
420  }
421  while_3_break: /* CIL Label */ ;
422  }
423  {
424#line 90
425  while (1) {
426    while_8_continue: /* CIL Label */ ;
427#line 90
428    if (! shape) {
429      {
430#line 90
431      fail();
432      }
433    } else {
434
435    }
436    goto while_8_break;
437  }
438  while_8_break: /* CIL Label */ ;
439  }
440  {
441#line 91
442  while (1) {
443    while_9_continue: /* CIL Label */ ;
444    {
445#line 91
446    __cil_tmp16 = (void *)0;
447#line 91
448    __cil_tmp17 = (unsigned int )__cil_tmp16;
449#line 91
450    __cil_tmp18 = (unsigned int )shape;
451#line 91
452    __cil_tmp19 = __cil_tmp18 + 4;
453#line 91
454    __cil_tmp20 = *((struct list **)__cil_tmp19);
455#line 91
456    __cil_tmp21 = (unsigned int )__cil_tmp20;
457#line 91
458    __cil_tmp22 = __cil_tmp21 == __cil_tmp17;
459#line 91
460    if (! __cil_tmp22) {
461      {
462#line 91
463      fail();
464      }
465    } else {
466
467    }
468    }
469    goto while_9_break;
470  }
471  while_9_break: /* CIL Label */ ;
472  }
473  {
474#line 92
475  while (1) {
476    while_10_continue: /* CIL Label */ ;
477    {
478#line 92
479    __cil_tmp23 = *((struct node **)shape);
480#line 92
481    if (! __cil_tmp23) {
482      {
483#line 92
484      fail();
485      }
486    } else {
487
488    }
489    }
490    goto while_10_break;
491  }
492  while_10_break: /* CIL Label */ ;
493  }
494  {
495#line 93
496  while (1) {
497    while_11_continue: /* CIL Label */ ;
498    {
499#line 93
500    __cil_tmp24 = (void *)0;
501#line 93
502    __cil_tmp25 = (unsigned int )__cil_tmp24;
503#line 93
504    __cil_tmp26 = *((struct node **)shape);
505#line 93
506    __cil_tmp27 = *((struct node **)__cil_tmp26);
507#line 93
508    __cil_tmp28 = (unsigned int )__cil_tmp27;
509#line 93
510    __cil_tmp29 = __cil_tmp28 == __cil_tmp25;
511#line 93
512    if (! __cil_tmp29) {
513      {
514#line 93
515      fail();
516      }
517    } else {
518
519    }
520    }
521    goto while_11_break;
522  }
523  while_11_break: /* CIL Label */ ;
524  }
525#line 94
526  return;
527}
528}
529#line 96 "test-0177.c"
530static void inspect_after(struct list *shape ) 
531{ struct node *pos ;
532  void *__cil_tmp3 ;
533  unsigned int __cil_tmp4 ;
534  unsigned int __cil_tmp5 ;
535  unsigned int __cil_tmp6 ;
536  struct list *__cil_tmp7 ;
537  unsigned int __cil_tmp8 ;
538  int __cil_tmp9 ;
539  void *__cil_tmp10 ;
540  unsigned int __cil_tmp11 ;
541  struct node *__cil_tmp12 ;
542  unsigned int __cil_tmp13 ;
543  int __cil_tmp14 ;
544  struct node *__cil_tmp15 ;
545  int __cil_tmp16 ;
546
547  {
548  {
549#line 99
550  while (1) {
551    while_12_continue: /* CIL Label */ ;
552#line 99
553    if (! shape) {
554      {
555#line 99
556      fail();
557      }
558    } else {
559
560    }
561    goto while_12_break;
562  }
563  while_12_break: /* CIL Label */ ;
564  }
565  {
566#line 100
567  while (1) {
568    while_13_continue: /* CIL Label */ ;
569    {
570#line 100
571    __cil_tmp3 = (void *)0;
572#line 100
573    __cil_tmp4 = (unsigned int )__cil_tmp3;
574#line 100
575    __cil_tmp5 = (unsigned int )shape;
576#line 100
577    __cil_tmp6 = __cil_tmp5 + 4;
578#line 100
579    __cil_tmp7 = *((struct list **)__cil_tmp6);
580#line 100
581    __cil_tmp8 = (unsigned int )__cil_tmp7;
582#line 100
583    __cil_tmp9 = __cil_tmp8 == __cil_tmp4;
584#line 100
585    if (! __cil_tmp9) {
586      {
587#line 100
588      fail();
589      }
590    } else {
591
592    }
593    }
594    goto while_13_break;
595  }
596  while_13_break: /* CIL Label */ ;
597  }
598  {
599#line 101
600  while (1) {
601    while_14_continue: /* CIL Label */ ;
602    {
603#line 101
604    __cil_tmp10 = (void *)0;
605#line 101
606    __cil_tmp11 = (unsigned int )__cil_tmp10;
607#line 101
608    __cil_tmp12 = *((struct node **)shape);
609#line 101
610    __cil_tmp13 = (unsigned int )__cil_tmp12;
611#line 101
612    __cil_tmp14 = __cil_tmp13 != __cil_tmp11;
613#line 101
614    if (! __cil_tmp14) {
615      {
616#line 101
617      fail();
618      }
619    } else {
620
621    }
622    }
623    goto while_14_break;
624  }
625  while_14_break: /* CIL Label */ ;
626  }
627#line 105
628  pos = *((struct node **)shape);
629  {
630#line 105
631  while (1) {
632    while_15_continue: /* CIL Label */ ;
633#line 105
634    if (*((struct node **)pos)) {
635
636    } else {
637      goto while_15_break;
638    }
639#line 105
640    pos = *((struct node **)pos);
641  }
642  while_15_break: /* CIL Label */ ;
643  }
644  {
645#line 106
646  while (1) {
647    while_16_continue: /* CIL Label */ ;
648    {
649#line 106
650    __cil_tmp15 = *((struct node **)pos);
651#line 106
652    __cil_tmp16 = ! __cil_tmp15;
653#line 106
654    if (! __cil_tmp16) {
655      {
656#line 106
657      fail();
658      }
659    } else {
660
661    }
662    }
663    goto while_16_break;
664  }
665  while_16_break: /* CIL Label */ ;
666  }
667#line 107
668  return;
669}
670}
671#line 109 "test-0177.c"
672int main(void) 
673{ struct list *data ;
674  struct node *node ;
675  void *tmp ;
676  struct list *item ;
677  void *tmp___0 ;
678  int tmp___1 ;
679  struct node *node___0 ;
680  struct node *snext ;
681  void *__cil_tmp9 ;
682  unsigned int __cil_tmp10 ;
683  void *__cil_tmp11 ;
684  unsigned int __cil_tmp12 ;
685  unsigned int __cil_tmp13 ;
686  unsigned int __cil_tmp14 ;
687  unsigned int __cil_tmp15 ;
688  unsigned int __cil_tmp16 ;
689  unsigned int __cil_tmp17 ;
690  unsigned int __cil_tmp18 ;
691  void *__cil_tmp19 ;
692  void *__cil_tmp20 ;
693
694  {
695#line 111
696  __cil_tmp9 = (void *)0;
697#line 111
698  data = (struct list *)__cil_tmp9;
699  {
700#line 112
701  while (1) {
702    while_17_continue: /* CIL Label */ ;
703    {
704#line 112
705    tmp___1 = __VERIFIER_nondet_int();
706    }
707#line 112
708    if (tmp___1) {
709
710    } else {
711      goto while_17_break;
712    }
713    {
714#line 113
715    __cil_tmp10 = (unsigned int )8UL;
716#line 113
717    tmp = malloc(__cil_tmp10);
718#line 113
719    node = (struct node *)tmp;
720    }
721#line 114
722    if (! node) {
723      {
724#line 115
725      abort();
726      }
727    } else {
728
729    }
730    {
731#line 117
732    __cil_tmp11 = (void *)0;
733#line 117
734    *((struct node **)node) = (struct node *)__cil_tmp11;
735#line 118
736    __cil_tmp12 = (unsigned int )node;
737#line 118
738    __cil_tmp13 = __cil_tmp12 + 4;
739#line 118
740    *((int *)__cil_tmp13) = __VERIFIER_nondet_int();
741#line 120
742    __cil_tmp14 = (unsigned int )8UL;
743#line 120
744    tmp___0 = malloc(__cil_tmp14);
745#line 120
746    item = (struct list *)tmp___0;
747    }
748#line 121
749    if (! item) {
750      {
751#line 122
752      abort();
753      }
754    } else {
755
756    }
757#line 124
758    *((struct node **)item) = node;
759#line 125
760    __cil_tmp15 = (unsigned int )item;
761#line 125
762    __cil_tmp16 = __cil_tmp15 + 4;
763#line 125
764    *((struct list **)__cil_tmp16) = data;
765#line 126
766    data = item;
767  }
768  while_17_break: /* CIL Label */ ;
769  }
770#line 129
771  if (! data) {
772#line 130
773    return (0);
774  } else {
775
776  }
777  {
778#line 132
779  inspect_before(data);
780  }
781  {
782#line 135
783  while (1) {
784    while_18_continue: /* CIL Label */ ;
785    {
786#line 135
787    __cil_tmp17 = (unsigned int )data;
788#line 135
789    __cil_tmp18 = __cil_tmp17 + 4;
790#line 135
791    if (*((struct list **)__cil_tmp18)) {
792
793    } else {
794      goto while_18_break;
795    }
796    }
797    {
798#line 136
799    data = seq_sort_core(data);
800    }
801  }
802  while_18_break: /* CIL Label */ ;
803  }
804  {
805#line 138
806  inspect_after(data);
807#line 140
808  node___0 = *((struct node **)data);
809#line 141
810  __cil_tmp19 = (void *)data;
811#line 141
812  free(__cil_tmp19);
813  }
814  {
815#line 143
816  while (1) {
817    while_19_continue: /* CIL Label */ ;
818#line 143
819    if (node___0) {
820
821    } else {
822      goto while_19_break;
823    }
824    {
825#line 144
826    snext = *((struct node **)node___0);
827#line 145
828    __cil_tmp20 = (void *)node___0;
829#line 145
830    free(__cil_tmp20);
831#line 146
832    node___0 = snext;
833    }
834  }
835  while_19_break: /* CIL Label */ ;
836  }
837#line 149
838  return (0);
839}
840}