Showing error 1418

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


Source:

  1void __VERIFIER_assert(int cond) {
  2  if (!(cond)) {
  3    ERROR: goto ERROR;
  4  }
  5  return;
  6}
  7
  8extern void __assert_fail (__const char *__assertion, __const char *__file,
  9      unsigned int __line, __const char *__function)
 10     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
 11extern void __assert_perror_fail (int __errnum, __const char *__file,
 12      unsigned int __line,
 13      __const char *__function)
 14     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
 15extern void __assert (const char *__assertion, const char *__file, int __line)
 16     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
 17
 18typedef long int ptrdiff_t;
 19typedef long unsigned int size_t;
 20typedef int wchar_t;
 21
 22typedef unsigned char __u_char;
 23typedef unsigned short int __u_short;
 24typedef unsigned int __u_int;
 25typedef unsigned long int __u_long;
 26typedef signed char __int8_t;
 27typedef unsigned char __uint8_t;
 28typedef signed short int __int16_t;
 29typedef unsigned short int __uint16_t;
 30typedef signed int __int32_t;
 31typedef unsigned int __uint32_t;
 32typedef signed long int __int64_t;
 33typedef unsigned long int __uint64_t;
 34typedef long int __quad_t;
 35typedef unsigned long int __u_quad_t;
 36typedef unsigned long int __dev_t;
 37typedef unsigned int __uid_t;
 38typedef unsigned int __gid_t;
 39typedef unsigned long int __ino_t;
 40typedef unsigned long int __ino64_t;
 41typedef unsigned int __mode_t;
 42typedef unsigned long int __nlink_t;
 43typedef long int __off_t;
 44typedef long int __off64_t;
 45typedef int __pid_t;
 46typedef struct { int __val[2]; } __fsid_t;
 47typedef long int __clock_t;
 48typedef unsigned long int __rlim_t;
 49typedef unsigned long int __rlim64_t;
 50typedef unsigned int __id_t;
 51typedef long int __time_t;
 52typedef unsigned int __useconds_t;
 53typedef long int __suseconds_t;
 54typedef int __daddr_t;
 55typedef long int __swblk_t;
 56typedef int __key_t;
 57typedef int __clockid_t;
 58typedef void * __timer_t;
 59typedef long int __blksize_t;
 60typedef long int __blkcnt_t;
 61typedef long int __blkcnt64_t;
 62typedef unsigned long int __fsblkcnt_t;
 63typedef unsigned long int __fsblkcnt64_t;
 64typedef unsigned long int __fsfilcnt_t;
 65typedef unsigned long int __fsfilcnt64_t;
 66typedef long int __ssize_t;
 67typedef __off64_t __loff_t;
 68typedef __quad_t *__qaddr_t;
 69typedef char *__caddr_t;
 70typedef long int __intptr_t;
 71typedef unsigned int __socklen_t;
 72struct _IO_FILE;
 73
 74typedef struct _IO_FILE FILE;
 75
 76
 77typedef struct _IO_FILE __FILE;
 78
 79
 80
 81
 82
 83typedef struct
 84{
 85  int __count;
 86  union
 87  {
 88
 89    unsigned int __wch;
 90
 91
 92
 93    char __wchb[4];
 94  } __value;
 95} __mbstate_t;
 96typedef struct
 97{
 98  __off_t __pos;
 99  __mbstate_t __state;
100} _G_fpos_t;
101typedef struct
102{
103  __off64_t __pos;
104  __mbstate_t __state;
105} _G_fpos64_t;
106typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
107typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
108typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
109typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
110typedef __builtin_va_list __gnuc_va_list;
111struct _IO_jump_t; struct _IO_FILE;
112typedef void _IO_lock_t;
113struct _IO_marker {
114  struct _IO_marker *_next;
115  struct _IO_FILE *_sbuf;
116  int _pos;
117};
118enum __codecvt_result
119{
120  __codecvt_ok,
121  __codecvt_partial,
122  __codecvt_error,
123  __codecvt_noconv
124};
125struct _IO_FILE {
126  int _flags;
127  char* _IO_read_ptr;
128  char* _IO_read_end;
129  char* _IO_read_base;
130  char* _IO_write_base;
131  char* _IO_write_ptr;
132  char* _IO_write_end;
133  char* _IO_buf_base;
134  char* _IO_buf_end;
135  char *_IO_save_base;
136  char *_IO_backup_base;
137  char *_IO_save_end;
138  struct _IO_marker *_markers;
139  struct _IO_FILE *_chain;
140  int _fileno;
141  int _flags2;
142  __off_t _old_offset;
143  unsigned short _cur_column;
144  signed char _vtable_offset;
145  char _shortbuf[1];
146  _IO_lock_t *_lock;
147  __off64_t _offset;
148  void *__pad1;
149  void *__pad2;
150  void *__pad3;
151  void *__pad4;
152  size_t __pad5;
153  int _mode;
154  char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)];
155};
156typedef struct _IO_FILE _IO_FILE;
157struct _IO_FILE_plus;
158extern struct _IO_FILE_plus _IO_2_1_stdin_;
159extern struct _IO_FILE_plus _IO_2_1_stdout_;
160extern struct _IO_FILE_plus _IO_2_1_stderr_;
161typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);
162typedef __ssize_t __io_write_fn (void *__cookie, __const char *__buf,
163     size_t __n);
164typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w);
165typedef int __io_close_fn (void *__cookie);
166extern int __underflow (_IO_FILE *);
167extern int __uflow (_IO_FILE *);
168extern int __overflow (_IO_FILE *, int);
169extern int _IO_getc (_IO_FILE *__fp);
170extern int _IO_putc (int __c, _IO_FILE *__fp);
171extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__));
172extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__));
173extern int _IO_peekc_locked (_IO_FILE *__fp);
174extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__));
175extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__));
176extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__));
177extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict,
178   __gnuc_va_list, int *__restrict);
179extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict,
180    __gnuc_va_list);
181extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t);
182extern size_t _IO_sgetn (_IO_FILE *, void *, size_t);
183extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int);
184extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int);
185extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__));
186typedef __gnuc_va_list va_list;
187typedef __off_t off_t;
188typedef __ssize_t ssize_t;
189
190typedef _G_fpos_t fpos_t;
191
192extern struct _IO_FILE *stdin;
193extern struct _IO_FILE *stdout;
194extern struct _IO_FILE *stderr;
195
196extern int remove (__const char *__filename) __attribute__ ((__nothrow__ , __leaf__));
197extern int rename (__const char *__old, __const char *__new) __attribute__ ((__nothrow__ , __leaf__));
198
199extern int renameat (int __oldfd, __const char *__old, int __newfd,
200       __const char *__new) __attribute__ ((__nothrow__ , __leaf__));
201
202extern FILE *tmpfile (void) ;
203
204
205
206
207
208
209
210extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ;
211
212
213
214
215
216extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ;
217extern char *tempnam (__const char *__dir, __const char *__pfx)
218     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ;
219
220extern int fclose (FILE *__stream);
221extern int fflush (FILE *__stream);
222
223extern int fflush_unlocked (FILE *__stream);
224
225extern FILE *fopen (__const char *__restrict __filename,
226      __const char *__restrict __modes) ;
227extern FILE *freopen (__const char *__restrict __filename,
228        __const char *__restrict __modes,
229        FILE *__restrict __stream) ;
230
231extern FILE *fdopen (int __fd, __const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ;
232extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes)
233  __attribute__ ((__nothrow__ , __leaf__)) ;
234extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ;
235
236extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__));
237extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
238      int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__));
239
240extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
241         size_t __size) __attribute__ ((__nothrow__ , __leaf__));
242extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
243
244extern int fprintf (FILE *__restrict __stream,
245      __const char *__restrict __format, ...);
246extern int printf (__const char *__restrict __format, ...);
247extern int sprintf (char *__restrict __s,
248      __const char *__restrict __format, ...) __attribute__ ((__nothrow__));
249extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
250       __gnuc_va_list __arg);
251extern int vprintf (__const char *__restrict __format, __gnuc_va_list __arg);
252extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
253       __gnuc_va_list __arg) __attribute__ ((__nothrow__));
254
255
256extern int snprintf (char *__restrict __s, size_t __maxlen,
257       __const char *__restrict __format, ...)
258     __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4)));
259extern int vsnprintf (char *__restrict __s, size_t __maxlen,
260        __const char *__restrict __format, __gnuc_va_list __arg)
261     __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0)));
262
263extern int vdprintf (int __fd, __const char *__restrict __fmt,
264       __gnuc_va_list __arg)
265     __attribute__ ((__format__ (__printf__, 2, 0)));
266extern int dprintf (int __fd, __const char *__restrict __fmt, ...)
267     __attribute__ ((__format__ (__printf__, 2, 3)));
268
269extern int fscanf (FILE *__restrict __stream,
270     __const char *__restrict __format, ...) ;
271extern int scanf (__const char *__restrict __format, ...) ;
272extern int sscanf (__const char *__restrict __s,
273     __const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__));
274extern int fscanf (FILE *__restrict __stream, __const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") ;
275extern int scanf (__const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") ;
276extern int sscanf (__const char *__restrict __s, __const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__));
277
278
279extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format,
280      __gnuc_va_list __arg)
281     __attribute__ ((__format__ (__scanf__, 2, 0))) ;
282extern int vscanf (__const char *__restrict __format, __gnuc_va_list __arg)
283     __attribute__ ((__format__ (__scanf__, 1, 0))) ;
284extern int vsscanf (__const char *__restrict __s,
285      __const char *__restrict __format, __gnuc_va_list __arg)
286     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0)));
287extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf")
288     __attribute__ ((__format__ (__scanf__, 2, 0))) ;
289extern int vscanf (__const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf")
290     __attribute__ ((__format__ (__scanf__, 1, 0))) ;
291extern int vsscanf (__const char *__restrict __s, __const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__))
292     __attribute__ ((__format__ (__scanf__, 2, 0)));
293
294
295extern int fgetc (FILE *__stream);
296extern int getc (FILE *__stream);
297extern int getchar (void);
298
299extern int getc_unlocked (FILE *__stream);
300extern int getchar_unlocked (void);
301extern int fgetc_unlocked (FILE *__stream);
302
303extern int fputc (int __c, FILE *__stream);
304extern int putc (int __c, FILE *__stream);
305extern int putchar (int __c);
306
307extern int fputc_unlocked (int __c, FILE *__stream);
308extern int putc_unlocked (int __c, FILE *__stream);
309extern int putchar_unlocked (int __c);
310extern int getw (FILE *__stream);
311extern int putw (int __w, FILE *__stream);
312
313extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
314     ;
315extern char *gets (char *__s) ;
316
317extern __ssize_t __getdelim (char **__restrict __lineptr,
318          size_t *__restrict __n, int __delimiter,
319          FILE *__restrict __stream) ;
320extern __ssize_t getdelim (char **__restrict __lineptr,
321        size_t *__restrict __n, int __delimiter,
322        FILE *__restrict __stream) ;
323extern __ssize_t getline (char **__restrict __lineptr,
324       size_t *__restrict __n,
325       FILE *__restrict __stream) ;
326
327extern int fputs (__const char *__restrict __s, FILE *__restrict __stream);
328extern int puts (__const char *__s);
329extern int ungetc (int __c, FILE *__stream);
330extern size_t fread (void *__restrict __ptr, size_t __size,
331       size_t __n, FILE *__restrict __stream) ;
332extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
333        size_t __n, FILE *__restrict __s);
334
335extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
336         size_t __n, FILE *__restrict __stream) ;
337extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
338          size_t __n, FILE *__restrict __stream);
339
340extern int fseek (FILE *__stream, long int __off, int __whence);
341extern long int ftell (FILE *__stream) ;
342extern void rewind (FILE *__stream);
343
344extern int fseeko (FILE *__stream, __off_t __off, int __whence);
345extern __off_t ftello (FILE *__stream) ;
346
347extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos);
348extern int fsetpos (FILE *__stream, __const fpos_t *__pos);
349
350
351extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
352extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
353extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
354
355extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
356extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
357extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
358
359extern void perror (__const char *__s);
360
361extern int sys_nerr;
362extern __const char *__const sys_errlist[];
363extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
364extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
365extern FILE *popen (__const char *__command, __const char *__modes) ;
366extern int pclose (FILE *__stream);
367extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__));
368extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
369extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
370extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
371
372
373extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ;
374extern void *calloc (size_t __nmemb, size_t __size)
375     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ;
376extern void *realloc (void *__ptr, size_t __size)
377     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
378extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__));
379extern void cfree (void *__ptr) __attribute__ ((__nothrow__ , __leaf__));
380extern void *memalign (size_t __alignment, size_t __size)
381     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ;
382extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ;
383extern void * pvalloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ;
384extern void *(*__morecore) (ptrdiff_t __size);
385extern void *__default_morecore (ptrdiff_t __size)
386     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__));
387struct mallinfo
388{
389  int arena;
390  int ordblks;
391  int smblks;
392  int hblks;
393  int hblkhd;
394  int usmblks;
395  int fsmblks;
396  int uordblks;
397  int fordblks;
398  int keepcost;
399};
400extern struct mallinfo mallinfo (void) __attribute__ ((__nothrow__ , __leaf__));
401extern int mallopt (int __param, int __val) __attribute__ ((__nothrow__ , __leaf__));
402extern int malloc_trim (size_t __pad) __attribute__ ((__nothrow__ , __leaf__));
403extern size_t malloc_usable_size (void *__ptr) __attribute__ ((__nothrow__ , __leaf__));
404extern void malloc_stats (void) __attribute__ ((__nothrow__ , __leaf__));
405extern int malloc_info (int __options, FILE *__fp) __attribute__ ((__nothrow__ , __leaf__));
406extern void *malloc_get_state (void) __attribute__ ((__nothrow__ , __leaf__));
407extern int malloc_set_state (void *__ptr) __attribute__ ((__nothrow__ , __leaf__));
408extern void (*__volatile __malloc_initialize_hook) (void)
409     __attribute__ ((__deprecated__));
410extern void (*__volatile __free_hook) (void *__ptr,
411         __const void *)
412     __attribute__ ((__deprecated__));
413extern void *(*__volatile __malloc_hook) (size_t __size,
414            __const void *)
415     __attribute__ ((__deprecated__));
416extern void *(*__volatile __realloc_hook) (void *__ptr,
417             size_t __size,
418             __const void *)
419     __attribute__ ((__deprecated__));
420extern void *(*__volatile __memalign_hook) (size_t __alignment,
421       size_t __size,
422       __const void *)
423     __attribute__ ((__deprecated__));
424extern void (*__volatile __after_morecore_hook) (void);
425extern void __malloc_check_init (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__));
426
427int CURRENTLY_UNSAFE;
428int main(void) {
429 int * p1 = malloc(sizeof(int));
430 int * p2 = malloc(sizeof(int));
431 if(p1!=0 && p2!=0) {
432  __VERIFIER_assert(p1!=p2);
433 }
434 return 0;
435}