diff options
author | blazy <blazy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2006-10-20 12:37:13 +0000 |
---|---|---|
committer | blazy <blazy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2006-10-20 12:37:13 +0000 |
commit | ca0c62265eb8cdd5fb0d8a8b34ee77baf3de987e (patch) | |
tree | 50a139db8e2ac51c6ff41f3790ff72aa417ed3be /test/ccured_olden/newbisort/ssplain.c | |
parent | 43668d9109b1f36329646fd07324d435be6f0050 (diff) | |
download | compcert-ca0c62265eb8cdd5fb0d8a8b34ee77baf3de987e.tar.gz compcert-ca0c62265eb8cdd5fb0d8a8b34ee77baf3de987e.zip |
Ajout du banc de tests de CCured (Olden benchmark suite, cf.
CCured: type-safe retrofitting of legacy code, G.Necula et al.)
rapportCompcert_all.txt liste les erreurs produites par ccomp.
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@121 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'test/ccured_olden/newbisort/ssplain.c')
-rw-r--r-- | test/ccured_olden/newbisort/ssplain.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/test/ccured_olden/newbisort/ssplain.c b/test/ccured_olden/newbisort/ssplain.c new file mode 100644 index 00000000..b178e5f5 --- /dev/null +++ b/test/ccured_olden/newbisort/ssplain.c @@ -0,0 +1,75 @@ +#include <assert.h> +#include <stdio.h> +#include <stdlib.h> +#include <stdarg.h> +#include <limits.h> +#include <stddef.h> +#include "ssplain.h" + +void chatting(char *s, ...) +{ + va_list ap; + va_start(ap,s); + vfprintf(stderr, s, ap); + va_end(ap); +} + +void __Olden_panic(char *s, ...) +{ + va_list ap; + va_start(ap,s); + vfprintf(stderr, s, ap); + va_end(ap); + exit(-1); +} + +#ifdef SS_RAND +double drand48() +{ + double d; + d = (double) random() / LONG_MAX; + return d; +} + + +long lrand48() +{ + long l = random(); + return l; +} + +void srand48(long seed) +{ + srand(seed); +} +#endif SS_RAND + + +static unsigned long bytes_allocated = 0; +static unsigned long allocations = 0; + +void* +ssplain_malloc(int size) +{ + allocations++; + bytes_allocated+=size; + return malloc(size); +} + +void* +ssplain_calloc(int nelems, int size) +{ + void *p; + allocations++; + bytes_allocated+= nelems * size; + p = calloc(nelems, size); + assert (p); + return p; +} + +void +ssplain_alloc_stats() +{ + chatting("Allocation stats: %d bytes allocated in %d allocations\n", + bytes_allocated, allocations); +} |