Showing error 2193

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


Source:

   1# 1 "lazy01_bad.c"
   2# 1 "<built-in>"
   3# 1 "<command-line>"
   4# 1 "lazy01_bad.c"
   5# 1 "/usr/include/pthread.h" 1 3 4
   6# 23 "/usr/include/pthread.h" 3 4
   7# 1 "/usr/include/features.h" 1 3 4
   8# 363 "/usr/include/features.h" 3 4
   9# 1 "/usr/include/sys/cdefs.h" 1 3 4
  10# 372 "/usr/include/sys/cdefs.h" 3 4
  11# 1 "/usr/include/bits/wordsize.h" 1 3 4
  12# 373 "/usr/include/sys/cdefs.h" 2 3 4
  13# 364 "/usr/include/features.h" 2 3 4
  14# 387 "/usr/include/features.h" 3 4
  15# 1 "/usr/include/gnu/stubs.h" 1 3 4
  16
  17
  18
  19# 1 "/usr/include/bits/wordsize.h" 1 3 4
  20# 5 "/usr/include/gnu/stubs.h" 2 3 4
  21
  22
  23# 1 "/usr/include/gnu/stubs-32.h" 1 3 4
  24# 8 "/usr/include/gnu/stubs.h" 2 3 4
  25# 388 "/usr/include/features.h" 2 3 4
  26# 24 "/usr/include/pthread.h" 2 3 4
  27# 1 "/usr/include/endian.h" 1 3 4
  28# 37 "/usr/include/endian.h" 3 4
  29# 1 "/usr/include/bits/endian.h" 1 3 4
  30# 38 "/usr/include/endian.h" 2 3 4
  31# 61 "/usr/include/endian.h" 3 4
  32# 1 "/usr/include/bits/byteswap.h" 1 3 4
  33# 62 "/usr/include/endian.h" 2 3 4
  34# 25 "/usr/include/pthread.h" 2 3 4
  35# 1 "/usr/include/sched.h" 1 3 4
  36# 27 "/usr/include/sched.h" 3 4
  37# 1 "/usr/include/bits/types.h" 1 3 4
  38# 28 "/usr/include/bits/types.h" 3 4
  39# 1 "/usr/include/bits/wordsize.h" 1 3 4
  40# 29 "/usr/include/bits/types.h" 2 3 4
  41
  42
  43typedef unsigned char __u_char;
  44typedef unsigned short int __u_short;
  45typedef unsigned int __u_int;
  46typedef unsigned long int __u_long;
  47
  48
  49typedef signed char __int8_t;
  50typedef unsigned char __uint8_t;
  51typedef signed short int __int16_t;
  52typedef unsigned short int __uint16_t;
  53typedef signed int __int32_t;
  54typedef unsigned int __uint32_t;
  55
  56
  57
  58
  59__extension__ typedef signed long long int __int64_t;
  60__extension__ typedef unsigned long long int __uint64_t;
  61
  62
  63
  64
  65
  66
  67
  68__extension__ typedef long long int __quad_t;
  69__extension__ typedef unsigned long long int __u_quad_t;
  70# 131 "/usr/include/bits/types.h" 3 4
  71# 1 "/usr/include/bits/typesizes.h" 1 3 4
  72# 132 "/usr/include/bits/types.h" 2 3 4
  73
  74
  75__extension__ typedef __u_quad_t __dev_t;
  76__extension__ typedef unsigned int __uid_t;
  77__extension__ typedef unsigned int __gid_t;
  78__extension__ typedef unsigned long int __ino_t;
  79__extension__ typedef __u_quad_t __ino64_t;
  80__extension__ typedef unsigned int __mode_t;
  81__extension__ typedef unsigned int __nlink_t;
  82__extension__ typedef long int __off_t;
  83__extension__ typedef __quad_t __off64_t;
  84__extension__ typedef int __pid_t;
  85__extension__ typedef struct { int __val[2]; } __fsid_t;
  86__extension__ typedef long int __clock_t;
  87__extension__ typedef unsigned long int __rlim_t;
  88__extension__ typedef __u_quad_t __rlim64_t;
  89__extension__ typedef unsigned int __id_t;
  90__extension__ typedef long int __time_t;
  91__extension__ typedef unsigned int __useconds_t;
  92__extension__ typedef long int __suseconds_t;
  93
  94__extension__ typedef int __daddr_t;
  95__extension__ typedef long int __swblk_t;
  96__extension__ typedef int __key_t;
  97
  98
  99__extension__ typedef int __clockid_t;
 100
 101
 102__extension__ typedef void * __timer_t;
 103
 104
 105__extension__ typedef long int __blksize_t;
 106
 107
 108
 109
 110__extension__ typedef long int __blkcnt_t;
 111__extension__ typedef __quad_t __blkcnt64_t;
 112
 113
 114__extension__ typedef unsigned long int __fsblkcnt_t;
 115__extension__ typedef __u_quad_t __fsblkcnt64_t;
 116
 117
 118__extension__ typedef unsigned long int __fsfilcnt_t;
 119__extension__ typedef __u_quad_t __fsfilcnt64_t;
 120
 121__extension__ typedef int __ssize_t;
 122
 123
 124
 125typedef __off64_t __loff_t;
 126typedef __quad_t *__qaddr_t;
 127typedef char *__caddr_t;
 128
 129
 130__extension__ typedef int __intptr_t;
 131
 132
 133__extension__ typedef unsigned int __socklen_t;
 134# 28 "/usr/include/sched.h" 2 3 4
 135
 136
 137# 1 "/usr/lib/gcc/i686-redhat-linux/4.6.3/include/stddef.h" 1 3 4
 138# 212 "/usr/lib/gcc/i686-redhat-linux/4.6.3/include/stddef.h" 3 4
 139typedef unsigned int size_t;
 140# 31 "/usr/include/sched.h" 2 3 4
 141
 142
 143
 144# 1 "/usr/include/time.h" 1 3 4
 145# 74 "/usr/include/time.h" 3 4
 146
 147
 148typedef __time_t time_t;
 149
 150
 151
 152# 120 "/usr/include/time.h" 3 4
 153struct timespec
 154  {
 155    __time_t tv_sec;
 156    long int tv_nsec;
 157  };
 158# 35 "/usr/include/sched.h" 2 3 4
 159
 160
 161typedef __pid_t pid_t;
 162
 163
 164
 165
 166
 167# 1 "/usr/include/bits/sched.h" 1 3 4
 168# 74 "/usr/include/bits/sched.h" 3 4
 169struct sched_param
 170  {
 171    int __sched_priority;
 172  };
 173
 174
 175# 97 "/usr/include/bits/sched.h" 3 4
 176
 177
 178
 179
 180
 181
 182
 183
 184struct __sched_param
 185  {
 186    int __sched_priority;
 187  };
 188# 120 "/usr/include/bits/sched.h" 3 4
 189typedef unsigned long int __cpu_mask;
 190
 191
 192
 193
 194
 195
 196typedef struct
 197{
 198  __cpu_mask __bits[1024 / (8 * sizeof (__cpu_mask))];
 199} cpu_set_t;
 200# 203 "/usr/include/bits/sched.h" 3 4
 201
 202
 203extern int __sched_cpucount (size_t __setsize, const cpu_set_t *__setp)
 204  __attribute__ ((__nothrow__));
 205extern cpu_set_t *__sched_cpualloc (size_t __count) __attribute__ ((__nothrow__)) ;
 206extern void __sched_cpufree (cpu_set_t *__set) __attribute__ ((__nothrow__));
 207
 208
 209# 44 "/usr/include/sched.h" 2 3 4
 210
 211
 212
 213
 214
 215
 216
 217extern int sched_setparam (__pid_t __pid, __const struct sched_param *__param)
 218     __attribute__ ((__nothrow__));
 219
 220
 221extern int sched_getparam (__pid_t __pid, struct sched_param *__param) __attribute__ ((__nothrow__));
 222
 223
 224extern int sched_setscheduler (__pid_t __pid, int __policy,
 225          __const struct sched_param *__param) __attribute__ ((__nothrow__));
 226
 227
 228extern int sched_getscheduler (__pid_t __pid) __attribute__ ((__nothrow__));
 229
 230
 231extern int sched_yield (void) __attribute__ ((__nothrow__));
 232
 233
 234extern int sched_get_priority_max (int __algorithm) __attribute__ ((__nothrow__));
 235
 236
 237extern int sched_get_priority_min (int __algorithm) __attribute__ ((__nothrow__));
 238
 239
 240extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __attribute__ ((__nothrow__));
 241# 126 "/usr/include/sched.h" 3 4
 242
 243# 26 "/usr/include/pthread.h" 2 3 4
 244# 1 "/usr/include/time.h" 1 3 4
 245# 30 "/usr/include/time.h" 3 4
 246
 247
 248
 249
 250
 251
 252
 253
 254# 1 "/usr/lib/gcc/i686-redhat-linux/4.6.3/include/stddef.h" 1 3 4
 255# 39 "/usr/include/time.h" 2 3 4
 256
 257
 258
 259# 1 "/usr/include/bits/time.h" 1 3 4
 260# 43 "/usr/include/time.h" 2 3 4
 261# 58 "/usr/include/time.h" 3 4
 262
 263
 264typedef __clock_t clock_t;
 265
 266
 267
 268# 92 "/usr/include/time.h" 3 4
 269typedef __clockid_t clockid_t;
 270# 104 "/usr/include/time.h" 3 4
 271typedef __timer_t timer_t;
 272# 131 "/usr/include/time.h" 3 4
 273
 274
 275struct tm
 276{
 277  int tm_sec;
 278  int tm_min;
 279  int tm_hour;
 280  int tm_mday;
 281  int tm_mon;
 282  int tm_year;
 283  int tm_wday;
 284  int tm_yday;
 285  int tm_isdst;
 286
 287
 288  long int tm_gmtoff;
 289  __const char *tm_zone;
 290
 291
 292
 293
 294};
 295
 296
 297
 298
 299
 300
 301
 302
 303struct itimerspec
 304  {
 305    struct timespec it_interval;
 306    struct timespec it_value;
 307  };
 308
 309
 310struct sigevent;
 311# 180 "/usr/include/time.h" 3 4
 312
 313
 314
 315extern clock_t clock (void) __attribute__ ((__nothrow__));
 316
 317
 318extern time_t time (time_t *__timer) __attribute__ ((__nothrow__));
 319
 320
 321extern double difftime (time_t __time1, time_t __time0)
 322     __attribute__ ((__nothrow__)) __attribute__ ((__const__));
 323
 324
 325extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__));
 326
 327
 328
 329
 330
 331extern size_t strftime (char *__restrict __s, size_t __maxsize,
 332   __const char *__restrict __format,
 333   __const struct tm *__restrict __tp) __attribute__ ((__nothrow__));
 334
 335# 215 "/usr/include/time.h" 3 4
 336# 1 "/usr/include/xlocale.h" 1 3 4
 337# 28 "/usr/include/xlocale.h" 3 4
 338typedef struct __locale_struct
 339{
 340
 341  struct __locale_data *__locales[13];
 342
 343
 344  const unsigned short int *__ctype_b;
 345  const int *__ctype_tolower;
 346  const int *__ctype_toupper;
 347
 348
 349  const char *__names[13];
 350} *__locale_t;
 351
 352
 353typedef __locale_t locale_t;
 354# 216 "/usr/include/time.h" 2 3 4
 355
 356extern size_t strftime_l (char *__restrict __s, size_t __maxsize,
 357     __const char *__restrict __format,
 358     __const struct tm *__restrict __tp,
 359     __locale_t __loc) __attribute__ ((__nothrow__));
 360# 230 "/usr/include/time.h" 3 4
 361
 362
 363
 364extern struct tm *gmtime (__const time_t *__timer) __attribute__ ((__nothrow__));
 365
 366
 367
 368extern struct tm *localtime (__const time_t *__timer) __attribute__ ((__nothrow__));
 369
 370
 371
 372
 373
 374extern struct tm *gmtime_r (__const time_t *__restrict __timer,
 375       struct tm *__restrict __tp) __attribute__ ((__nothrow__));
 376
 377
 378
 379extern struct tm *localtime_r (__const time_t *__restrict __timer,
 380          struct tm *__restrict __tp) __attribute__ ((__nothrow__));
 381
 382
 383
 384
 385
 386extern char *asctime (__const struct tm *__tp) __attribute__ ((__nothrow__));
 387
 388
 389extern char *ctime (__const time_t *__timer) __attribute__ ((__nothrow__));
 390
 391
 392
 393
 394
 395
 396
 397extern char *asctime_r (__const struct tm *__restrict __tp,
 398   char *__restrict __buf) __attribute__ ((__nothrow__));
 399
 400
 401extern char *ctime_r (__const time_t *__restrict __timer,
 402        char *__restrict __buf) __attribute__ ((__nothrow__));
 403
 404
 405
 406
 407extern char *__tzname[2];
 408extern int __daylight;
 409extern long int __timezone;
 410
 411
 412
 413
 414extern char *tzname[2];
 415
 416
 417
 418extern void tzset (void) __attribute__ ((__nothrow__));
 419
 420
 421
 422extern int daylight;
 423extern long int timezone;
 424
 425
 426
 427
 428
 429extern int stime (__const time_t *__when) __attribute__ ((__nothrow__));
 430# 313 "/usr/include/time.h" 3 4
 431extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__));
 432
 433
 434extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__));
 435
 436
 437extern int dysize (int __year) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
 438# 328 "/usr/include/time.h" 3 4
 439extern int nanosleep (__const struct timespec *__requested_time,
 440        struct timespec *__remaining);
 441
 442
 443
 444extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__));
 445
 446
 447extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__));
 448
 449
 450extern int clock_settime (clockid_t __clock_id, __const struct timespec *__tp)
 451     __attribute__ ((__nothrow__));
 452
 453
 454
 455
 456
 457
 458extern int clock_nanosleep (clockid_t __clock_id, int __flags,
 459       __const struct timespec *__req,
 460       struct timespec *__rem);
 461
 462
 463extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__));
 464
 465
 466
 467
 468extern int timer_create (clockid_t __clock_id,
 469    struct sigevent *__restrict __evp,
 470    timer_t *__restrict __timerid) __attribute__ ((__nothrow__));
 471
 472
 473extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__));
 474
 475
 476extern int timer_settime (timer_t __timerid, int __flags,
 477     __const struct itimerspec *__restrict __value,
 478     struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__));
 479
 480
 481extern int timer_gettime (timer_t __timerid, struct itimerspec *__value)
 482     __attribute__ ((__nothrow__));
 483
 484
 485extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__));
 486# 417 "/usr/include/time.h" 3 4
 487
 488# 27 "/usr/include/pthread.h" 2 3 4
 489
 490# 1 "/usr/include/bits/pthreadtypes.h" 1 3 4
 491# 36 "/usr/include/bits/pthreadtypes.h" 3 4
 492typedef unsigned long int pthread_t;
 493
 494
 495typedef union
 496{
 497  char __size[36];
 498  long int __align;
 499} pthread_attr_t;
 500
 501
 502typedef struct __pthread_internal_slist
 503{
 504  struct __pthread_internal_slist *__next;
 505} __pthread_slist_t;
 506
 507
 508
 509
 510typedef union
 511{
 512  struct __pthread_mutex_s
 513  {
 514    int __lock;
 515    unsigned int __count;
 516    int __owner;
 517
 518
 519    int __kind;
 520    unsigned int __nusers;
 521    __extension__ union
 522    {
 523      int __spins;
 524      __pthread_slist_t __list;
 525    };
 526  } __data;
 527  char __size[24];
 528  long int __align;
 529} pthread_mutex_t;
 530
 531typedef union
 532{
 533  char __size[4];
 534  long int __align;
 535} pthread_mutexattr_t;
 536
 537
 538
 539
 540typedef union
 541{
 542  struct
 543  {
 544    int __lock;
 545    unsigned int __futex;
 546    __extension__ unsigned long long int __total_seq;
 547    __extension__ unsigned long long int __wakeup_seq;
 548    __extension__ unsigned long long int __woken_seq;
 549    void *__mutex;
 550    unsigned int __nwaiters;
 551    unsigned int __broadcast_seq;
 552  } __data;
 553  char __size[48];
 554  __extension__ long long int __align;
 555} pthread_cond_t;
 556
 557typedef union
 558{
 559  char __size[4];
 560  long int __align;
 561} pthread_condattr_t;
 562
 563
 564
 565typedef unsigned int pthread_key_t;
 566
 567
 568
 569typedef int pthread_once_t;
 570
 571
 572
 573
 574
 575typedef union
 576{
 577  struct
 578  {
 579    int __lock;
 580    unsigned int __nr_readers;
 581    unsigned int __readers_wakeup;
 582    unsigned int __writer_wakeup;
 583    unsigned int __nr_readers_queued;
 584    unsigned int __nr_writers_queued;
 585
 586
 587    unsigned char __flags;
 588    unsigned char __shared;
 589    unsigned char __pad1;
 590    unsigned char __pad2;
 591    int __writer;
 592  } __data;
 593  char __size[32];
 594  long int __align;
 595} pthread_rwlock_t;
 596
 597typedef union
 598{
 599  char __size[8];
 600  long int __align;
 601} pthread_rwlockattr_t;
 602
 603
 604
 605
 606
 607typedef volatile int pthread_spinlock_t;
 608
 609
 610
 611
 612typedef union
 613{
 614  char __size[20];
 615  long int __align;
 616} pthread_barrier_t;
 617
 618typedef union
 619{
 620  char __size[4];
 621  int __align;
 622} pthread_barrierattr_t;
 623# 29 "/usr/include/pthread.h" 2 3 4
 624# 1 "/usr/include/bits/setjmp.h" 1 3 4
 625# 29 "/usr/include/bits/setjmp.h" 3 4
 626typedef int __jmp_buf[6];
 627# 30 "/usr/include/pthread.h" 2 3 4
 628# 1 "/usr/include/bits/wordsize.h" 1 3 4
 629# 31 "/usr/include/pthread.h" 2 3 4
 630
 631
 632
 633enum
 634{
 635  PTHREAD_CREATE_JOINABLE,
 636
 637  PTHREAD_CREATE_DETACHED
 638
 639};
 640
 641
 642
 643enum
 644{
 645  PTHREAD_MUTEX_TIMED_NP,
 646  PTHREAD_MUTEX_RECURSIVE_NP,
 647  PTHREAD_MUTEX_ERRORCHECK_NP,
 648  PTHREAD_MUTEX_ADAPTIVE_NP
 649
 650  ,
 651  PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_TIMED_NP,
 652  PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP,
 653  PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP,
 654  PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL
 655
 656
 657
 658
 659
 660};
 661
 662
 663
 664
 665enum
 666{
 667  PTHREAD_MUTEX_STALLED,
 668  PTHREAD_MUTEX_STALLED_NP = PTHREAD_MUTEX_STALLED,
 669  PTHREAD_MUTEX_ROBUST,
 670  PTHREAD_MUTEX_ROBUST_NP = PTHREAD_MUTEX_ROBUST
 671};
 672# 115 "/usr/include/pthread.h" 3 4
 673enum
 674{
 675  PTHREAD_RWLOCK_PREFER_READER_NP,
 676  PTHREAD_RWLOCK_PREFER_WRITER_NP,
 677  PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP,
 678  PTHREAD_RWLOCK_DEFAULT_NP = PTHREAD_RWLOCK_PREFER_READER_NP
 679};
 680# 147 "/usr/include/pthread.h" 3 4
 681enum
 682{
 683  PTHREAD_INHERIT_SCHED,
 684
 685  PTHREAD_EXPLICIT_SCHED
 686
 687};
 688
 689
 690
 691enum
 692{
 693  PTHREAD_SCOPE_SYSTEM,
 694
 695  PTHREAD_SCOPE_PROCESS
 696
 697};
 698
 699
 700
 701enum
 702{
 703  PTHREAD_PROCESS_PRIVATE,
 704
 705  PTHREAD_PROCESS_SHARED
 706
 707};
 708# 182 "/usr/include/pthread.h" 3 4
 709struct _pthread_cleanup_buffer
 710{
 711  void (*__routine) (void *);
 712  void *__arg;
 713  int __canceltype;
 714  struct _pthread_cleanup_buffer *__prev;
 715};
 716
 717
 718enum
 719{
 720  PTHREAD_CANCEL_ENABLE,
 721
 722  PTHREAD_CANCEL_DISABLE
 723
 724};
 725enum
 726{
 727  PTHREAD_CANCEL_DEFERRED,
 728
 729  PTHREAD_CANCEL_ASYNCHRONOUS
 730
 731};
 732# 220 "/usr/include/pthread.h" 3 4
 733
 734
 735
 736
 737
 738extern int pthread_create (pthread_t *__restrict __newthread,
 739      __const pthread_attr_t *__restrict __attr,
 740      void *(*__start_routine) (void *),
 741      void *__restrict __arg) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 3)));
 742
 743
 744
 745
 746
 747extern void pthread_exit (void *__retval) __attribute__ ((__noreturn__));
 748
 749
 750
 751
 752
 753
 754
 755extern int pthread_join (pthread_t __th, void **__thread_return);
 756# 263 "/usr/include/pthread.h" 3 4
 757extern int pthread_detach (pthread_t __th) __attribute__ ((__nothrow__));
 758
 759
 760
 761extern pthread_t pthread_self (void) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
 762
 763
 764extern int pthread_equal (pthread_t __thread1, pthread_t __thread2) __attribute__ ((__nothrow__));
 765
 766
 767
 768
 769
 770
 771
 772extern int pthread_attr_init (pthread_attr_t *__attr) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
 773
 774
 775extern int pthread_attr_destroy (pthread_attr_t *__attr)
 776     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
 777
 778
 779extern int pthread_attr_getdetachstate (__const pthread_attr_t *__attr,
 780     int *__detachstate)
 781     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
 782
 783
 784extern int pthread_attr_setdetachstate (pthread_attr_t *__attr,
 785     int __detachstate)
 786     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
 787
 788
 789
 790extern int pthread_attr_getguardsize (__const pthread_attr_t *__attr,
 791          size_t *__guardsize)
 792     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
 793
 794
 795extern int pthread_attr_setguardsize (pthread_attr_t *__attr,
 796          size_t __guardsize)
 797     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
 798
 799
 800
 801extern int pthread_attr_getschedparam (__const pthread_attr_t *__restrict
 802           __attr,
 803           struct sched_param *__restrict __param)
 804     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
 805
 806
 807extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr,
 808           __const struct sched_param *__restrict
 809           __param) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
 810
 811
 812extern int pthread_attr_getschedpolicy (__const pthread_attr_t *__restrict
 813     __attr, int *__restrict __policy)
 814     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
 815
 816
 817extern int pthread_attr_setschedpolicy (pthread_attr_t *__attr, int __policy)
 818     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
 819
 820
 821extern int pthread_attr_getinheritsched (__const pthread_attr_t *__restrict
 822      __attr, int *__restrict __inherit)
 823     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
 824
 825
 826extern int pthread_attr_setinheritsched (pthread_attr_t *__attr,
 827      int __inherit)
 828     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
 829
 830
 831
 832extern int pthread_attr_getscope (__const pthread_attr_t *__restrict __attr,
 833      int *__restrict __scope)
 834     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
 835
 836
 837extern int pthread_attr_setscope (pthread_attr_t *__attr, int __scope)
 838     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
 839
 840
 841extern int pthread_attr_getstackaddr (__const pthread_attr_t *__restrict
 842          __attr, void **__restrict __stackaddr)
 843     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))) __attribute__ ((__deprecated__));
 844
 845
 846
 847
 848
 849extern int pthread_attr_setstackaddr (pthread_attr_t *__attr,
 850          void *__stackaddr)
 851     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__));
 852
 853
 854extern int pthread_attr_getstacksize (__const pthread_attr_t *__restrict
 855          __attr, size_t *__restrict __stacksize)
 856     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
 857
 858
 859
 860
 861extern int pthread_attr_setstacksize (pthread_attr_t *__attr,
 862          size_t __stacksize)
 863     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
 864
 865
 866
 867extern int pthread_attr_getstack (__const pthread_attr_t *__restrict __attr,
 868      void **__restrict __stackaddr,
 869      size_t *__restrict __stacksize)
 870     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2, 3)));
 871
 872
 873
 874
 875extern int pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr,
 876      size_t __stacksize) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
 877# 413 "/usr/include/pthread.h" 3 4
 878extern int pthread_setschedparam (pthread_t __target_thread, int __policy,
 879      __const struct sched_param *__param)
 880     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3)));
 881
 882
 883extern int pthread_getschedparam (pthread_t __target_thread,
 884      int *__restrict __policy,
 885      struct sched_param *__restrict __param)
 886     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 3)));
 887
 888
 889extern int pthread_setschedprio (pthread_t __target_thread, int __prio)
 890     __attribute__ ((__nothrow__));
 891# 478 "/usr/include/pthread.h" 3 4
 892extern int pthread_once (pthread_once_t *__once_control,
 893    void (*__init_routine) (void)) __attribute__ ((__nonnull__ (1, 2)));
 894# 490 "/usr/include/pthread.h" 3 4
 895extern int pthread_setcancelstate (int __state, int *__oldstate);
 896
 897
 898
 899extern int pthread_setcanceltype (int __type, int *__oldtype);
 900
 901
 902extern int pthread_cancel (pthread_t __th);
 903
 904
 905
 906
 907extern void pthread_testcancel (void);
 908
 909
 910
 911
 912typedef struct
 913{
 914  struct
 915  {
 916    __jmp_buf __cancel_jmp_buf;
 917    int __mask_was_saved;
 918  } __cancel_jmp_buf[1];
 919  void *__pad[4];
 920} __pthread_unwind_buf_t __attribute__ ((__aligned__));
 921# 524 "/usr/include/pthread.h" 3 4
 922struct __pthread_cleanup_frame
 923{
 924  void (*__cancel_routine) (void *);
 925  void *__cancel_arg;
 926  int __do_it;
 927  int __cancel_type;
 928};
 929# 664 "/usr/include/pthread.h" 3 4
 930extern void __pthread_register_cancel (__pthread_unwind_buf_t *__buf)
 931     __attribute__ ((__regparm__ (1)));
 932# 676 "/usr/include/pthread.h" 3 4
 933extern void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf)
 934  __attribute__ ((__regparm__ (1)));
 935# 717 "/usr/include/pthread.h" 3 4
 936extern void __pthread_unwind_next (__pthread_unwind_buf_t *__buf)
 937     __attribute__ ((__regparm__ (1))) __attribute__ ((__noreturn__))
 938
 939     __attribute__ ((__weak__))
 940
 941     ;
 942
 943
 944
 945struct __jmp_buf_tag;
 946extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __attribute__ ((__nothrow__));
 947
 948
 949
 950
 951
 952extern int pthread_mutex_init (pthread_mutex_t *__mutex,
 953          __const pthread_mutexattr_t *__mutexattr)
 954     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
 955
 956
 957extern int pthread_mutex_destroy (pthread_mutex_t *__mutex)
 958     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
 959
 960
 961extern int pthread_mutex_trylock (pthread_mutex_t *__mutex)
 962     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
 963
 964
 965extern int pthread_mutex_lock (pthread_mutex_t *__mutex)
 966     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
 967
 968
 969
 970extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
 971        __const struct timespec *__restrict
 972        __abstime) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
 973
 974
 975
 976extern int pthread_mutex_unlock (pthread_mutex_t *__mutex)
 977     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
 978
 979
 980
 981extern int pthread_mutex_getprioceiling (__const pthread_mutex_t *
 982      __restrict __mutex,
 983      int *__restrict __prioceiling)
 984     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
 985
 986
 987
 988extern int pthread_mutex_setprioceiling (pthread_mutex_t *__restrict __mutex,
 989      int __prioceiling,
 990      int *__restrict __old_ceiling)
 991     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 3)));
 992
 993
 994
 995
 996extern int pthread_mutex_consistent (pthread_mutex_t *__mutex)
 997     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
 998# 790 "/usr/include/pthread.h" 3 4
 999extern int pthread_mutexattr_init (pthread_mutexattr_t *__attr)
1000     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1001
1002
1003extern int pthread_mutexattr_destroy (pthread_mutexattr_t *__attr)
1004     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1005
1006
1007extern int pthread_mutexattr_getpshared (__const pthread_mutexattr_t *
1008      __restrict __attr,
1009      int *__restrict __pshared)
1010     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1011
1012
1013extern int pthread_mutexattr_setpshared (pthread_mutexattr_t *__attr,
1014      int __pshared)
1015     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1016
1017
1018
1019extern int pthread_mutexattr_gettype (__const pthread_mutexattr_t *__restrict
1020          __attr, int *__restrict __kind)
1021     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1022
1023
1024
1025
1026extern int pthread_mutexattr_settype (pthread_mutexattr_t *__attr, int __kind)
1027     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1028
1029
1030
1031extern int pthread_mutexattr_getprotocol (__const pthread_mutexattr_t *
1032       __restrict __attr,
1033       int *__restrict __protocol)
1034     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1035
1036
1037
1038extern int pthread_mutexattr_setprotocol (pthread_mutexattr_t *__attr,
1039       int __protocol)
1040     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1041
1042
1043extern int pthread_mutexattr_getprioceiling (__const pthread_mutexattr_t *
1044          __restrict __attr,
1045          int *__restrict __prioceiling)
1046     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1047
1048
1049extern int pthread_mutexattr_setprioceiling (pthread_mutexattr_t *__attr,
1050          int __prioceiling)
1051     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1052
1053
1054
1055extern int pthread_mutexattr_getrobust (__const pthread_mutexattr_t *__attr,
1056     int *__robustness)
1057     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1058
1059
1060
1061
1062
1063
1064
1065extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr,
1066     int __robustness)
1067     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1068# 872 "/usr/include/pthread.h" 3 4
1069extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock,
1070    __const pthread_rwlockattr_t *__restrict
1071    __attr) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1072
1073
1074extern int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock)
1075     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1076
1077
1078extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock)
1079     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1080
1081
1082extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock)
1083  __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1084
1085
1086
1087extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,
1088           __const struct timespec *__restrict
1089           __abstime) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1090
1091
1092
1093extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock)
1094     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1095
1096
1097extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock)
1098     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1099
1100
1101
1102extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,
1103           __const struct timespec *__restrict
1104           __abstime) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1105
1106
1107
1108extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock)
1109     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1110
1111
1112
1113
1114
1115extern int pthread_rwlockattr_init (pthread_rwlockattr_t *__attr)
1116     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1117
1118
1119extern int pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr)
1120     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1121
1122
1123extern int pthread_rwlockattr_getpshared (__const pthread_rwlockattr_t *
1124       __restrict __attr,
1125       int *__restrict __pshared)
1126     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1127
1128
1129extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *__attr,
1130       int __pshared)
1131     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1132
1133
1134extern int pthread_rwlockattr_getkind_np (__const pthread_rwlockattr_t *
1135       __restrict __attr,
1136       int *__restrict __pref)
1137     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1138
1139
1140extern int pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *__attr,
1141       int __pref) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1142
1143
1144
1145
1146
1147
1148
1149extern int pthread_cond_init (pthread_cond_t *__restrict __cond,
1150         __const pthread_condattr_t *__restrict
1151         __cond_attr) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1152
1153
1154extern int pthread_cond_destroy (pthread_cond_t *__cond)
1155     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1156
1157
1158extern int pthread_cond_signal (pthread_cond_t *__cond)
1159     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1160
1161
1162extern int pthread_cond_broadcast (pthread_cond_t *__cond)
1163     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1164
1165
1166
1167
1168
1169
1170extern int pthread_cond_wait (pthread_cond_t *__restrict __cond,
1171         pthread_mutex_t *__restrict __mutex)
1172     __attribute__ ((__nonnull__ (1, 2)));
1173# 984 "/usr/include/pthread.h" 3 4
1174extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
1175       pthread_mutex_t *__restrict __mutex,
1176       __const struct timespec *__restrict
1177       __abstime) __attribute__ ((__nonnull__ (1, 2, 3)));
1178
1179
1180
1181
1182extern int pthread_condattr_init (pthread_condattr_t *__attr)
1183     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1184
1185
1186extern int pthread_condattr_destroy (pthread_condattr_t *__attr)
1187     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1188
1189
1190extern int pthread_condattr_getpshared (__const pthread_condattr_t *
1191     __restrict __attr,
1192     int *__restrict __pshared)
1193     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1194
1195
1196extern int pthread_condattr_setpshared (pthread_condattr_t *__attr,
1197     int __pshared) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1198
1199
1200
1201extern int pthread_condattr_getclock (__const pthread_condattr_t *
1202          __restrict __attr,
1203          __clockid_t *__restrict __clock_id)
1204     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1205
1206
1207extern int pthread_condattr_setclock (pthread_condattr_t *__attr,
1208          __clockid_t __clock_id)
1209     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1210# 1028 "/usr/include/pthread.h" 3 4
1211extern int pthread_spin_init (pthread_spinlock_t *__lock, int __pshared)
1212     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1213
1214
1215extern int pthread_spin_destroy (pthread_spinlock_t *__lock)
1216     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1217
1218
1219extern int pthread_spin_lock (pthread_spinlock_t *__lock)
1220     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1221
1222
1223extern int pthread_spin_trylock (pthread_spinlock_t *__lock)
1224     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1225
1226
1227extern int pthread_spin_unlock (pthread_spinlock_t *__lock)
1228     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1229
1230
1231
1232
1233
1234
1235extern int pthread_barrier_init (pthread_barrier_t *__restrict __barrier,
1236     __const pthread_barrierattr_t *__restrict
1237     __attr, unsigned int __count)
1238     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1239
1240
1241extern int pthread_barrier_destroy (pthread_barrier_t *__barrier)
1242     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1243
1244
1245extern int pthread_barrier_wait (pthread_barrier_t *__barrier)
1246     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1247
1248
1249
1250extern int pthread_barrierattr_init (pthread_barrierattr_t *__attr)
1251     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1252
1253
1254extern int pthread_barrierattr_destroy (pthread_barrierattr_t *__attr)
1255     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1256
1257
1258extern int pthread_barrierattr_getpshared (__const pthread_barrierattr_t *
1259        __restrict __attr,
1260        int *__restrict __pshared)
1261     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1262
1263
1264extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr,
1265        int __pshared)
1266     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1267# 1095 "/usr/include/pthread.h" 3 4
1268extern int pthread_key_create (pthread_key_t *__key,
1269          void (*__destr_function) (void *))
1270     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1271
1272
1273extern int pthread_key_delete (pthread_key_t __key) __attribute__ ((__nothrow__));
1274
1275
1276extern void *pthread_getspecific (pthread_key_t __key) __attribute__ ((__nothrow__));
1277
1278
1279extern int pthread_setspecific (pthread_key_t __key,
1280    __const void *__pointer) __attribute__ ((__nothrow__)) ;
1281
1282
1283
1284
1285extern int pthread_getcpuclockid (pthread_t __thread_id,
1286      __clockid_t *__clock_id)
1287     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
1288# 1129 "/usr/include/pthread.h" 3 4
1289extern int pthread_atfork (void (*__prepare) (void),
1290      void (*__parent) (void),
1291      void (*__child) (void)) __attribute__ ((__nothrow__));
1292# 1143 "/usr/include/pthread.h" 3 4
1293
1294# 2 "lazy01_bad.c" 2
1295# 1 "/usr/include/assert.h" 1 3 4
1296# 66 "/usr/include/assert.h" 3 4
1297
1298
1299
1300extern void __assert_fail (__const char *__assertion, __const char *__file,
1301      unsigned int __line, __const char *__function)
1302     __attribute__ ((__nothrow__)) __attribute__ ((__noreturn__));
1303
1304
1305extern void __assert_perror_fail (int __errnum, __const char *__file,
1306      unsigned int __line,
1307      __const char *__function)
1308     __attribute__ ((__nothrow__)) __attribute__ ((__noreturn__));
1309
1310
1311
1312
1313extern void __assert (const char *__assertion, const char *__file, int __line)
1314     __attribute__ ((__nothrow__)) __attribute__ ((__noreturn__));
1315
1316
1317
1318# 3 "lazy01_bad.c" 2
1319
1320pthread_mutex_t mutex;
1321int data = 0;
1322
1323void *thread1(void *arg)
1324{
1325  pthread_mutex_lock(&mutex);
1326  data++;
1327  pthread_mutex_unlock(&mutex);
1328}
1329
1330
1331void *thread2(void *arg)
1332{
1333  pthread_mutex_lock(&mutex);
1334  data+=2;
1335  pthread_mutex_unlock(&mutex);
1336}
1337
1338
1339void *thread3(void *arg)
1340{
1341  pthread_mutex_lock(&mutex);
1342  if (data >= 3){
1343    ERROR: goto ERROR;
1344    ;
1345  }
1346  pthread_mutex_unlock(&mutex);
1347}
1348
1349
1350int main()
1351{
1352  pthread_mutex_init(&mutex, 0);
1353
1354  pthread_t t1, t2, t3;
1355
1356  pthread_create(&t1, 0, thread1, 0);
1357  pthread_create(&t2, 0, thread2, 0);
1358  pthread_create(&t3, 0, thread3, 0);
1359
1360  pthread_join(t1, 0);
1361  pthread_join(t2, 0);
1362  pthread_join(t3, 0);
1363
1364  return 0;
1365}