diff options
| author | Kathy Gray | 2015-06-29 14:06:01 +0100 |
|---|---|---|
| committer | Kathy Gray | 2015-06-29 14:06:01 +0100 |
| commit | 2e4be2314249c7c6d6222482cc3a37bef6ffb019 (patch) | |
| tree | 87e144cb6d8874cbd43fdc02d5fefb3db2593278 /src | |
| parent | 2dc2c065357d488054e77beb29cd26e031a3da98 (diff) | |
Return unknown for a == unknown or unknown == a. Fixes issue #15
Diffstat (limited to 'src')
| -rw-r--r-- | src/lem_interp/interp_lib.lem | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lem_interp/interp_lib.lem b/src/lem_interp/interp_lib.lem index b8076538..83bee732 100644 --- a/src/lem_interp/interp_lib.lem +++ b/src/lem_interp/interp_lib.lem @@ -89,6 +89,8 @@ end let has_unknown v = match detaint v with | V_vector _ _ vs -> List.any is_unknown vs + | V_unknown -> true + | _ -> false end let has_undef v = match detaint v with @@ -265,7 +267,10 @@ let extz direction (V_tuple[v1;v]) = let eq (V_tuple [x; y]) = let combo = binary_taint (fun v _ -> v) x y in - retaint combo (V_lit (L_aux (if value_eq (detaint x) (detaint y) then L_one else L_zero) Unknown)) + retaint combo + (if has_unknown x || has_unknown y + then V_unknown + else (V_lit (L_aux (if value_eq (detaint x) (detaint y) then L_one else L_zero) Unknown))) (* XXX interpret vectors as unsigned numbers for equality *) let eq_vec_range (V_tuple [v; r]) = eq (V_tuple [to_num Unsigned v; r]) ;; |
