Skip to content
This repository was archived by the owner on Oct 3, 2021. It is now read-only.

Commit 9cea49f

Browse files
authored
Merge pull request #1190 from sosy-lab/fix_data_model
Fix data model for some tasks
2 parents 5ba49e7 + e1b4c8c commit 9cea49f

21 files changed

+4542
-10335
lines changed

c/ldv-regression/alt_test.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
extern void abort(void);
2+
extern void __assert_fail(const char *, const char *, unsigned int, const char *) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
3+
void reach_error() { __assert_fail("0", "alt_test.i", 3, "reach_error"); }
4+
5+
#include <stdlib.h>
6+
7+
void __blast_assert()
8+
{
9+
ERROR: {reach_error();abort();}
10+
}
11+
12+
int globalState = 0;
13+
void* l_malloc(int);
14+
void l_free(void*);
15+
16+
int
17+
main(int argc, char* argv[]) {
18+
int *a = (int*) l_malloc(sizeof(int));
19+
l_free(a);
20+
l_free(a);
21+
return 0;
22+
}
23+
24+
void* l_malloc(int size) {
25+
void *retVal = malloc(size);
26+
if(retVal != ((void *)0))
27+
globalState=1;
28+
return retVal;
29+
}
30+
31+
void l_free(void* ptr) {
32+
if(ptr!=((void *)0)) ((globalState == 1) ? (0) : __blast_assert ());
33+
globalState = 0;
34+
free(ptr);
35+
}

0 commit comments

Comments
 (0)