diff options
| author | Alasdair Armstrong | 2018-09-28 17:19:13 +0100 |
|---|---|---|
| committer | Alasdair Armstrong | 2018-09-28 17:21:27 +0100 |
| commit | 88b25e94c9266a481af6704423c321fb18f2ac31 (patch) | |
| tree | 4ffdd6c95bfe6ab972322678b73cd42127af5fdd /lib/sail.h | |
| parent | 645a5d90df9fc8f89ab9d6868c1a51f7429a890d (diff) | |
Fix optimisation bug for certain if statements
When converting to A-normal form I just used the type of the then
branch of if statements to get the type of the whole if statement -
usually they'd be the same, but with flow typing one of the branches
can have a false constraint, which then allows the optimizer to fit
any integer into a 64-bit integer causing an overflow. The fix is to
correctly use the type the typechecker gives for the whole if
statement.
Also add decimal_string_of_bits to the C output.
Rename is_reftyp to is_ref_typ to be more consistent with other
is_X_typ functions in Ast_util.
Diffstat (limited to 'lib/sail.h')
| -rw-r--r-- | lib/sail.h | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -333,6 +333,8 @@ void string_drop(sail_string *dst, sail_string s, sail_int len); void string_of_int(sail_string *str, const sail_int i); void string_of_sail_bits(sail_string *str, const sail_bits op); void string_of_mach_bits(sail_string *str, const mach_bits op); +void decimal_string_of_sail_bits(sail_string *str, const sail_bits op); +void decimal_string_of_mach_bits(sail_string *str, const mach_bits op); /* * Utility function not callable from Sail! |
