Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

forge coverage failed with Error: could not find anchor: no matching instruction #2171

Closed
2 tasks done
cwang25 opened this issue Jun 30, 2022 · 2 comments
Closed
2 tasks done
Labels
T-bug Type: bug

Comments

@cwang25
Copy link

cwang25 commented Jun 30, 2022

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (49f35c7 2022-06-30T00:31:40.009286Z)

What command(s) is the bug in?

forge coverage

Operating System

macOS (Apple Silicon)

Describe the bug

When executing the forge coverage
The compile went through, but immediately after it failed with single line of error:

[⠊] Compiling...
[⠃] Compiling 26 files with 0.8.14
[⠊] Solc 0.8.14 finished in 1.77s
Compiler run successful (with warnings)
Analysing contracts...
Error: 
could not find anchor: no matching instruction in range <contract name>:226:2:22
@cwang25 cwang25 added the T-bug Type: bug label Jun 30, 2022
@guacamoleoverflow
Copy link

Might be a similar issue to #2165?

Minimal repro I've found for forge coverage seems to be any contract that has an empty function (other than constructor with is fine), also on 49f35c7

pragma solidity ^0.8.13;
contract A {
  function b() public {}
}

results in could not find anchor: no matching instruction in range A:63:2:0

@onbjerg
Copy link
Collaborator

onbjerg commented Jun 30, 2022

I'd wager it is because Solidity just optimizes the function away and doesn't bother with a source mapping. This will be fixed with #1965 which also covers other cases where bytecodes and source maps are missing 😄 Going to merge this issue into that one to keep the issue tracker clean. Thanks for the report 🙂

@onbjerg onbjerg closed this as completed Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bug Type: bug
Projects
None yet
Development

No branches or pull requests

3 participants