Skip to content

Commit

Permalink
add bool symbol in owi.c, whose implementation is the same as i32 sym…
Browse files Browse the repository at this point in the history
…bol for the time being
  • Loading branch information
Laplace-Demon committed Jun 17, 2024
1 parent 895006b commit 1b36ab7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/cmd/cmd_sym.ml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ let symbolic_extern_module :
; ( "f64_symbol"
, Symbolic.P.Extern_func.Extern_func
(Func (UArg Res, R1 F64), symbol (Ty_fp 64)) )
; ( "bool_symbol"
, Symbolic.P.Extern_func.Extern_func
(Func (UArg Res, R1 I32), symbol (Ty_bitv 32)) )
; ( "assume"
, Symbolic.P.Extern_func.Extern_func
(Func (Arg (I32, Res), R0), assume_i32) )
Expand Down
1 change: 1 addition & 0 deletions src/libc/include/owi.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ float owi_f32(void) __attribute__((import_module("symbolic"))) __attribute__((im

double owi_f64(void) __attribute__((import_module("symbolic"))) __attribute__((import_name("f64_symbol")));

_Bool owi_bool(void) __attribute__((import_module("symbolic"))) __attribute__((import_name("bool_symbol")));

void owi_assume(int c) __attribute__((import_module("symbolic"))) __attribute__((import_name("assume")));
void owi_assert(int c) __attribute__((import_module("symbolic"))) __attribute__((import_name("assert")));
Expand Down
2 changes: 2 additions & 0 deletions src/libc/src/owi.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ __attribute__((import_module("symbolic"), import_name("f32_symbol"))) float
owi_f32(void);
__attribute__((import_module("symbolic"), import_name("f64_symbol"))) double
owi_f64(void);
__attribute__((import_module("symbolic"), import_name("bool_symbol"))) _Bool
owi_bool(void);

__attribute__((import_module("symbolic"), import_name("assume"))) void
owi_assume(int);
Expand Down
12 changes: 7 additions & 5 deletions src/libc/src/test-comp.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#include <owi.h>

_Bool __VERIFIER_nondet_bool(void) {
_Bool var = owi_i32();
owi_assume(var == 0 || var == 1);
return var;
}
// _Bool __VERIFIER_nondet_bool(void) {
// _Bool var = owi_i32();
// owi_assume(var == 0 || var == 1);
// return var;
// }

_Bool __VERIFIER_nondet_bool(void) { return owi_bool(); }

char __VERIFIER_nondet_char(void) { return (char)owi_i32(); }

Expand Down

0 comments on commit 1b36ab7

Please sign in to comment.