peak
peak copied to clipboard
rewrite rule generator can choose "impossible" values
For example in https://github.com/cdonovick/peak/blob/2e6b964a55c655e0d9e5a320e51bd8dc1de50b0d/tests/test_aadt_mapping.py#L13
It finds a rewrite rule for 'Sub', but the enum it chooses for Inst.OpCode is '0' which is not from the set of possible OpCodes. This results from the fact that we are writing the sim.py functions using the if/elif/else pattern to emulate a case statement for Enum types
I suspect there is a similar issue for Sum types, but I do not have a particular example.
Possible Solutions:
- Change simulation functions to use an elif on the last case of the Enum types.
- Add in extra constraints in the rewrite rule generator to only work for valid Enum values. Downside is that this will increase the size/complexity of the SMT formula
@cdonovick thoughts?