summaryrefslogtreecommitdiff
path: root/src/reporting.ml
AgeCommit message (Collapse)Author
2021-03-05Add more location information to IRAlasdair
2020-05-12Add support for instrumenting generated C with branch coverage metricsAlasdair
Will call: void sail_branch_reached(int branch_id, char *source_file, int l1, int c1, int l2, int c2); on each branch caused by a match or if statement in the source code For each branch that is taken, will call: void sail_branch_taken(int branch_id, char *source_file, int l1, int c1, int l2, int c2) Every branch gets a unique identifier, and the functions are called with the source file location and line/character information for the start and end of each match case or then/else branch. sail_branch_reached is given the location info for the whole match statement.
2020-05-12Support for user-defined state and headers in new codegenAlasdair
All the code-generator options can now be controlled via a json configuration file Extra fields can be added to the sail_state struct using a codegen.extra_state key in the configuration json for the code generator If primitives want to modify the state they can be specified via codegen.state_primops To import such state, codegen.extra_headers can be used to add user-defined headers to the generated .h file
2019-11-11Make sure we include LEXP_cast register refs when slicing the specificationAlasdair Armstrong
Also make the Error type private, so it's only constructed through the functions we expose in reporting.mli
2019-06-28Add a warning for potentially unsafe castsAlasdair
2019-05-29Fix sail_truncate error message in SMTAlasdair Armstrong
2019-05-22Move Util.warn to Reporting, and make it take the location as a parameterAlasdair Armstrong
Also add a $suppress_warnings directive that ensures that no warnings are generated for a specific file.
2019-05-13Parse dereferences in orderinary expressionsAlasdair
2019-04-11SMT: Add property and counterexample directiveAlasdair Armstrong
Rather than generating SMT from a function called check_sat, now find any function with a $property directive and generate SMT for it, e.g. $property function prop_cap_round_trip(cap: bits(128)) -> bool = { let cap_rt = capToBits(capBitsToCapability(true, cap)); cap == cap_rt } $property function prop_base_lteq_top(capbits: bits(128)) -> bool = { let c = capBitsToCapability(true, capbits); let (base, top) = getCapBounds(c); let e = unsigned(c.E); e >= 51 | base <= top } The file property.ml has a function for gathering all the properties in a file, as well as a rewrite-pass for properties with type quantifiers, which allows us to handle properties like function prop forall 'n, 'n <= 100. (bv: bits('n)) -> bool = exp by rewriting to (conceptually) function prop(bv: bits(MAX_BIT_WIDTH)) -> bool = if length(bv) > 100 then true else exp The function return is now automatically negated (i.e. always true = unsat, sometimes false = sat), which makes sense for quickcheck-type properties.
2019-04-05Lem: Make generated assertion messages look nicer in prover outputAlasdair
Add a new short_loc_to_string function that produces just the file and line number as a single line. loc_to_string adds a bunch of terminal color codes and other formatting designed for producing pretty error-messages in the terminal, which isn't ideal when the string appears in prover output as part of an assert statement. This is should be purely an aesthetic change.
2018-12-26Some cleanupAlasdair Armstrong
2018-12-26More error messages improvmentsAlasdair Armstrong
2018-12-22Improve error messages and debuggingAlasdair Armstrong
Work on improving the formatting and quality of error messages When sail is invoked with sail -i, any type errors now drop the user down to the interactive prompt, with the interactive environment being the environment at the point the type error occurred, this means the typechecker state can be interactively queried in the interpreter to help diagnose type errors.
2018-11-20Add messages for assert failures without user defined messagesAlasdair Armstrong
Also fix some C optimisations
2018-11-19Don't re-check AST repeatedly in exp_lift_assign re-writeAlasdair Armstrong
This was _really_ slow - about 50secs for ARM. If this changes causes breakages we should fix them in some other way. Also using Reporting.err_unreachable in ANF translation, and fix slice optimization when creating slices larger than 64-bits in C translation
2018-10-31Remove Parse_ast.Int, add unique locationsAlasdair Armstrong
Remove Parse_ast.Int (for internal locations) as this was unused. Add a Parse_ast.Unique constructor to create unique locations. Change locate_X functions to take a function modifying locations, rather than just replacing them and add a function unique : l -> l that makes locations unique, such that `locate unique X` will make a locations in X unique.
2018-10-31Rename Reporting_basic to ReportingAlasdair Armstrong
There is no Reporting_complex, so it's not clear what the basic is intended to signify anyway. Add a GitHub issue link to any err_unreachable errors (as they are all bugs)