[FIRRTL] Crash with malformed annotation target
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 2.2k
- Forks
- 524
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 46
Description
`firtool ./test.fir` on the follow input:
```firrtl
circuit Foo: %[[
{
"class":"firrtl.transforms.DontTouchAnnotation",
"target":"~Foo|Foo.w"
}
]]
module Foo:
wire w : UInt<1>
```
Crashes with:
```
firtool: /scratch/verif/aryoung/plato-circt-tester/circt/lib/Dialect/FIRRTL/FIRRTLAnnotationHelper.cpp:204: std::optional circt::firrtl::resolveEntities(circt::firrtl::TokenAnnoTarget, circt::firrtl::CircuitOp, mlir::SymbolTable &, circt::firrtl::CircuitTargetCache &): Assertion `path.component.empty()' failed.
```
Which is an assert [here](https://github.com/llvm/circt/blob/main/lib/Dialect/FIRRTL/FIRRTLAnnotationHelper.cpp#L204). It seems like the assertion should be changed to a regular error message.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in lib/Dialect/FIRRTL/FIRRTLAnnotationHelper.cpp at the assertion around line 204, then reproduce the failure with the firtool input in the issue. Replace the assertion failure with a regular error for this malformed annotation target, and verify that firtool reports the error without crashing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100