From ca0c62265eb8cdd5fb0d8a8b34ee77baf3de987e Mon Sep 17 00:00:00 2001 From: blazy Date: Fri, 20 Oct 2006 12:37:13 +0000 Subject: 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 --- test/ccured_olden/bh/trusted_bh.c | 92 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 test/ccured_olden/bh/trusted_bh.c (limited to 'test/ccured_olden/bh/trusted_bh.c') diff --git a/test/ccured_olden/bh/trusted_bh.c b/test/ccured_olden/bh/trusted_bh.c new file mode 100644 index 00000000..6c76f8c2 --- /dev/null +++ b/test/ccured_olden/bh/trusted_bh.c @@ -0,0 +1,92 @@ +#include "defs.h" +#include +#include +#include +#include +#ifndef _MSVC +#include +#include +#endif + + +#ifndef NO_PERF_CHANGES +///* +// * ALLOCATE: memory allocation with error checking. +// */ +//void *allocate(int nb) +//{ +// void *mem; +// +// mem = (void *) calloc(nb, 1); /* calloc zeros memory */ +// if (mem == NULL) { +// fprintf(stderr, "allocate: not enuf memory (%d bytes)\n", nb); +// exit(1); +// } +// return (mem); +//} +#endif // NO_PERF_CHANGES + + + +// Now some wrappers +typedef struct { + void *_p; + void *_b; +} fatp_void; + +//fatp_void strcpy_fss(char *dest, char *src) { +// fatp_void res; +// strcpy(dest, src); +// res._p = (void*)dest; +// res._b = (void*)(dest + strlen(dest)); +// return res; +//} + +#ifndef NO_PERF_CHANGES + #ifdef node2body + #undef node2body + #endif + bodyptr node2body(nodeptr x) { + return (bodyptr)x; + } +#endif + +// And the wild version. I'm being lazy about types +fatp_void node2body_ww(fatp_void x) { + return x; +} + +typedef struct { + nodeptr *_p; + void *_b; + void *_e; +} seqp_node; +bodyptr node2body_sq(seqp_node x) { + if((void*)x._p < x._b || (void*)((char*)x._p + sizeof(body)) > x._e) { + fprintf(stderr, "Bounds check failed in node2body_sq\n"); + exit(1); + } + return (bodyptr)x._p; +} + +#ifndef NO_PERF_CHANGES + #ifdef node2cell + #undef node2cell + #endif + cellptr node2cell(nodeptr x) { + return (cellptr)x; + } +#endif + +// And the wild version.. I'm being lazy about types +fatp_void node2cell_ww(fatp_void x) { + return x; +} + +cellptr node2cell_sq(seqp_node x) { + // if((void*)x._p < x._b || (void*)((char*)x._p + sizeof(cell)) > x._e) { + // fprintf(stderr, "Bounds check failed in node2cell_sq\n"); + // exit(1); + // } + return (cellptr)x._p; +} -- cgit