llvm / llvm/circt

[FIRRTL] Crash when invalidating an enum

Open
#6,615 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug FIRRTL
Dominant language
C++
Stars
2.2k
Forks
524
Avg merge
3d 2h
Merged PRs (30d)
46

Description

The following circuit leads to a firtool crash:

circuit c:
  module c:
    wire w: {|a: UInt<8>, b: UInt<16>|}
    w is invalid

The backtrace is the following:

all types are supported
UNREACHABLE executed at circt/lib/Dialect/FIRRTL/Transforms/SFCCompat.cpp:129!
PLEASE submit a bug report to https://github.com/llvm/circt and include the crash backtrace.
Stack dump:
0.	Program arguments: firtool test.fir
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  firtool   0x000055a05acaa080 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 74
1  firtool   0x000055a05acaa493
2  firtool   0x000055a05aca78cb llvm::sys::RunSignalHandlers() + 146
3  firtool   0x000055a05aca9967
4  libc.so.6 0x00007b2b42e5c710
5  libc.so.6 0x00007b2b42eac83c
6  libc.so.6 0x00007b2b42e5c668 raise + 24
7  libc.so.6 0x00007b2b42e444b8 abort + 215
8  firtool   0x000055a05ac11d26
9  firtool   0x000055a05b1d847f
10 firtool   0x000055a05b1d84d7
11 firtool   0x000055a05b1d822e SFCCompatPass::runOnOperation() + 1764
12 firtool   0x000055a05c296047
13 firtool   0x000055a05c299d3a
14 firtool   0x000055a05abf0126
15 firtool   0x000055a05c29f7ad
16 firtool   0x000055a05c29646b mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) + 1009
17 firtool   0x000055a05c296742 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) + 366
18 firtool   0x000055a05c297888
19 firtool   0x000055a05c29a7f6
20 firtool   0x000055a05c299b20
21 firtool   0x000055a05c297dfd mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) + 1317
22 firtool   0x000055a05c297251 mlir::detail::OpToOpPassAdaptor::runOnOperation(bool) + 59
23 firtool   0x000055a05c296022
24 firtool   0x000055a05c299d3a
25 firtool   0x000055a05abf0126
26 firtool   0x000055a05c29f7ad
27 firtool   0x000055a05c29646b mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) + 1009
28 firtool   0x000055a05c296742 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) + 366
29 firtool   0x000055a05c297888
30 firtool   0x000055a05c29a7f6
31 firtool   0x000055a05c299b20
32 firtool   0x000055a05c297dfd mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) + 1317
33 firtool   0x000055a05c297251 mlir::detail::OpToOpPassAdaptor::runOnOperation(bool) + 59
34 firtool   0x000055a05c296022
35 firtool   0x000055a05c299d3a
36 firtool   0x000055a05abf0126
37 firtool   0x000055a05c29f7ad
38 firtool   0x000055a05c29646b mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) + 1009
39 firtool   0x000055a05c296742 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) + 366
40 firtool   0x000055a05c298652 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) + 86
41 firtool   0x000055a05c2984b1 mlir::PassManager::run(mlir::Operation*) + 1167
42 firtool   0x000055a05ab92057
43 firtool   0x000055a05ab924db
44 firtool   0x000055a05ab926c3
45 firtool   0x000055a05ab92d8f
46 firtool   0x000055a05ab931db main + 486
47 libc.so.6 0x00007b2b42e45cd0
48 libc.so.6 0x00007b2b42e45d8a __libc_start_main + 138
49 firtool   0x000055a05ab90d95 _start + 37

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the crash with the FIRRTL circuit in the issue using firtool. Start at circt/lib/Dialect/FIRRTL/Transforms/SFCCompat.cpp:129 and trace the invalid-enum invalidation path; done means this input no longer reaches the UNREACHABLE failure, with regression coverage for the case.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.