Skip to content

Fix warnings on non-exhaustive matches for rules #2248

Open

Description

@anvacaru

These warnings are emitted during the kompilation process.

[Warning] Compiler: Non exhaustive match detected:
`#lenOfHead(_)_EVM-ABI_Int_TypedArg`(`abi_type_tuple`(_))
        Source(/nix/store/0ldpwmslqv838p5gcw0cadyxnd96nbdm-python3.10-kevm-pyk-1.0.406/lib/python3.10/site-packages/kevm_pyk/kproj/evm-semantics/abi.md)
        Location(291,20,291,61)
        291 |       syntax Int ::= #lenOfHead ( TypedArg ) [function, total]
            .                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Warning] Compiler: Non exhaustive match detected:
`#isStaticType(_)_EVM-ABI_Bool_TypedArg`(`abi_type_tuple`(_))
        Source(/nix/store/0ldpwmslqv838p5gcw0cadyxnd96nbdm-python3.10-kevm-pyk-1.0.406/lib/python3.10/site-packages/kevm_pyk/kproj/evm-semantics/abi.md)
        Location(402,21,402,65)
        402 |       syntax Bool ::= #isStaticType ( TypedArg ) [function, total]
            .                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Warning] Compiler: Non exhaustive match detected:
`_<Gas__GAS-SYNTAX_Bool_Gas_Gas`(infGas(_),_)
        Source(/nix/store/0ldpwmslqv838p5gcw0cadyxnd96nbdm-python3.10-kevm-pyk-1.0.406/lib/python3.10/site-packages/kevm_pyk/kproj/evm-semantics/gas.md)
        Location(23,21,23,54)
        23 |        syntax Bool ::= Gas  "<Gas" Gas [function, total]
           .                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Warning] Compiler: Non exhaustive match detected:
`_<=Gas__GAS-SYNTAX_Bool_Gas_Gas`(infGas(_),infGas(_))
        Source(/nix/store/0ldpwmslqv838p5gcw0cadyxnd96nbdm-python3.10-kevm-pyk-1.0.406/lib/python3.10/site-packages/kevm_pyk/kproj/evm-semantics/gas.md)
        Location(24,21,24,54)
        24 |                      | Gas "<=Gas" Gas [function, total]
        ```

Activity

  1. self-assigned this
    on Jan 10, 2024
  2. anvacaru commented on Jan 10, 2024

    @anvacaru
    ContributorAuthor
    `#lenOfHead(_)_EVM-ABI_Int_TypedArg`(`abi_type_tuple`(_))

    The rule for #lenOfHead( #tuple(_) ) is missing. Maybe refactor all #lenOfHead rules into a single rule like:

    rule #lenOfHead ( _ ) => 32
    
    `#isStaticType(_)_EVM-ABI_Bool_TypedArg`(`abi_type_tuple`(_))

    The rule for #isStaticType (#tuple ( TUPLE_ARGS )) is missing. We should add some logic here that does an OR on isStaticType() for each argument in TUPLE_ARGS.

    1. and 4. Both rules below are marked as simplification, so the llvm-backend issues Non-Exhaustive match on the operators <Gas, <=Gas for these cases (source here).
        rule #gas(_)  <Gas _       => false [simplification]
        rule _       <=Gas #gas(_) => true  [simplification]
    

    Why do they have to be marked as simplification? Should the entire INFINITE-GAS module be marked as symbolic?
    cc @ehildenb @dkcumming

  3. dkcumming commented on Jan 10, 2024

    @dkcumming
    Contributor

    @anvacaru I believe the original rules that this module was replacing marked the rules as [simplification], and that I was getting slower results for performance if [simplification] was not added for this module. I concluded that it must be doing short circuit evaluation and avoiding evaluation LHS and RHS of the comparison if the attribute was added, but I don't have much confidence in that now. It is entirely possible that they ought not be marked [simplification].

    I am not sure if the whole module should be marked as symbolic sorry, perhaps @ehildenb can offer more insight.

  4. changed the title [-]Address warnings on non-exhaustive matches for rules[/-] [+]Fix warnings on non-exhaustive matches for rules[/+] on Jan 18, 2024
  5. removed their assignment
    on Jan 18, 2024
  6. added
    documentationImprovements or additions to documentation
    and removed
    documentationImprovements or additions to documentation
    on Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions