Skip to content
Snippets Groups Projects
Commit a49f2eed authored by Julien Signoles's avatar Julien Signoles
Browse files

Merge branch 'bugfix/basile/eacsl-bittree-compilation' into 'master'

[eacsl] Fix bittree compilation

See merge request frama-c/frama-c!2899
parents 159bca76 078a1a27
No related branches found
No related tags found
No related merge requests found
Showing
with 61 additions and 8 deletions
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
***************************************************************************/ ***************************************************************************/
#include "../../internals/e_acsl_malloc.h" #include "../../internals/e_acsl_malloc.h"
#include "../../internals/e_acsl_private_assert.h"
#include "e_acsl_bittree.h" #include "e_acsl_bittree.h"
...@@ -160,7 +161,7 @@ static bt_node * bt_get_leaf_from_block (bt_block * ptr) { ...@@ -160,7 +161,7 @@ static bt_node * bt_get_leaf_from_block (bt_block * ptr) {
== (ptr->ptr & curr->left->mask)) == (ptr->ptr & curr->left->mask))
curr = curr->left; curr = curr->left;
else else
vassert(0, "Unreachable", NULL); private_assert(0, "Unreachable", NULL);
} }
DASSERT(curr->is_leaf); DASSERT(curr->is_leaf);
DASSERT(curr->leaf == ptr); DASSERT(curr->leaf == ptr);
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include "../../internals/e_acsl_private_assert.h" #include "../../internals/e_acsl_private_assert.h"
#include "../../instrumentation_model/e_acsl_temporal.h" #include "../../instrumentation_model/e_acsl_temporal.h"
#include "../../numerical_model/e_acsl_floating_point.h" #include "../../numerical_model/e_acsl_floating_point.h"
#include "../internals/e_acsl_safe_locations.h"" #include "../internals/e_acsl_safe_locations.h"
#include "e_acsl_bittree.h" #include "e_acsl_bittree.h"
#include "../e_acsl_observation_model.h" #include "../e_acsl_observation_model.h"
...@@ -231,12 +231,12 @@ int eacsl_valid(void* ptr, size_t size, void *ptr_base, void *addrof_base) { ...@@ -231,12 +231,12 @@ int eacsl_valid(void* ptr, size_t size, void *ptr_base, void *addrof_base) {
bt_block * blk = lookup_allocated(ptr, size, ptr_base); bt_block * blk = lookup_allocated(ptr, size, ptr_base);
return return
size == 0 size == 0
|| || (
blk != NULL && !blk->is_readonly blk != NULL && !blk->is_readonly
#ifdef E_ACSL_TEMPORAL #ifdef E_ACSL_TEMPORAL
&& temporal_valid(ptr_base, addrof_base) && temporal_valid(ptr_base, addrof_base)
#endif #endif
; );
} }
/* return whether the size bytes of ptr are readable */ /* return whether the size bytes of ptr are readable */
...@@ -244,12 +244,12 @@ int eacsl_valid_read(void* ptr, size_t size, void *ptr_base, void *addrof_base) ...@@ -244,12 +244,12 @@ int eacsl_valid_read(void* ptr, size_t size, void *ptr_base, void *addrof_base)
bt_block * blk = lookup_allocated(ptr, size, ptr_base); bt_block * blk = lookup_allocated(ptr, size, ptr_base);
return return
size == 0 size == 0
|| || (
blk != NULL blk != NULL
#ifdef E_ACSL_TEMPORAL #ifdef E_ACSL_TEMPORAL
&& temporal_valid(ptr_base, addrof_base) && temporal_valid(ptr_base, addrof_base)
#endif #endif
; );
} }
/* return the base address of the block containing ptr */ /* return the base address of the block containing ptr */
...@@ -260,7 +260,7 @@ void* eacsl_base_addr(void* ptr) { ...@@ -260,7 +260,7 @@ void* eacsl_base_addr(void* ptr) {
} }
/* return the offset of `ptr` within its block */ /* return the offset of `ptr` within its block */
size_t offset(void* ptr) { size_t eacsl_offset(void* ptr) {
bt_block * tmp = bt_find(ptr); bt_block * tmp = bt_find(ptr);
private_assert(tmp != NULL, "\\offset of unallocated memory", NULL); private_assert(tmp != NULL, "\\offset of unallocated memory", NULL);
return ((uintptr_t)ptr - tmp->ptr); return ((uintptr_t)ptr - tmp->ptr);
...@@ -585,7 +585,7 @@ void eacsl_memory_init(int *argc_ref, char ***argv_ref, size_t ptr_size) { ...@@ -585,7 +585,7 @@ void eacsl_memory_init(int *argc_ref, char ***argv_ref, size_t ptr_size) {
/* Tracking safe locations */ /* Tracking safe locations */
collect_safe_locations(); collect_safe_locations();
int i; int i;
for (i = 0; i < get_safe_location_count(); i++) { for (i = 0; i < get_safe_locations_count(); i++) {
memory_location * loc = get_safe_location(i); memory_location * loc = get_safe_location(i);
void *addr = (void*)loc->address; void *addr = (void*)loc->address;
uintptr_t len = loc->length; uintptr_t len = loc->length;
......
/* run.config_ci, run.config_dev
COMMENT: Compile RTL with bittree memory model
STDOPT:#"-e-acsl-full-mtracking"
MACRO: ROOT_EACSL_GCC_OPTS_EXT --full-mtracking --memory-model bittree
*/
int main() {
return 0;
}
/* run.config_ci, run.config_dev
COMMENT: Compile RTL with segment memory model
STDOPT:#"-e-acsl-full-mtracking"
MACRO: ROOT_EACSL_GCC_OPTS_EXT --full-mtracking --memory-model segment
*/
int main() {
return 0;
}
[e-acsl] beginning translation.
[e-acsl] translation done in project "e-acsl".
[e-acsl] beginning translation.
[e-acsl] translation done in project "e-acsl".
/* Generated by Frama-C */
#include "stddef.h"
#include "stdio.h"
int main(void)
{
int __retres;
__e_acsl_memory_init((int *)0,(char ***)0,(size_t)8);
__e_acsl_store_block((void *)(& __retres),(size_t)4);
__e_acsl_full_init((void *)(& __retres));
__retres = 0;
__e_acsl_delete_block((void *)(& __retres));
__e_acsl_memory_clean();
return __retres;
}
/* Generated by Frama-C */
#include "stddef.h"
#include "stdio.h"
int main(void)
{
int __retres;
__e_acsl_memory_init((int *)0,(char ***)0,(size_t)8);
__e_acsl_store_block((void *)(& __retres),(size_t)4);
__e_acsl_full_init((void *)(& __retres));
__retres = 0;
__e_acsl_delete_block((void *)(& __retres));
__e_acsl_memory_clean();
return __retres;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment