circt icon indicating copy to clipboard operation
circt copied to clipboard

[LowerToHW] Crash involving `TestBenchDirAnnotation`

Open seldridge opened this issue 1 year ago • 1 comments

I came across the following crash when running some experiments:

FIRRTL version 4.0.0
circuit Foo: %[[
  {
    "class": "sifive.enterprise.firrtl.TestBenchDirAnnotation",
    "target": "verification"
  }
]]
  public module Foo:
    input a: UInt<1>

This produces the following stack trace:

PLEASE submit a bug report to https://github.com/llvm/circt and include the crash backtrace.
Stack dump:
0.	Program arguments: firtool crash.fir -mlir-print-ir-before=lower-firrtl-to-hw
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                  0x0000000105058e9c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  firtool                  0x000000010505739c llvm::sys::RunSignalHandlers() + 112
2  firtool                  0x0000000105059524 SignalHandler(int) + 332
3  libsystem_platform.dylib 0x000000018d9df584 _sigtramp + 56
4  firtool                  0x000000010546a450 (anonymous namespace)::FIRRTLModuleLowering::runOnOperation() + 784
5  firtool                  0x0000000105a217c0 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) + 576
6  firtool                  0x0000000105a23b20 mlir::PassManager::run(mlir::Operation*) + 1036
7  firtool                  0x0000000104f8b34c processBuffer(mlir::MLIRContext&, circt::firtool::FirtoolOptions&, mlir::TimingScope&, llvm::SourceMgr&, std::__1::optional<std::__1::unique_ptr<llvm::ToolOutputFile, std::__1::default_delete<llvm::ToolOutputFile>>>&) + 3796
8  firtool                  0x0000000104f8a3a8 processInputSplit(mlir::MLIRContext&, circt::firtool::FirtoolOptions&, mlir::TimingScope&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, std::__1::optional<std::__1::unique_ptr<llvm::ToolOutputFile, std::__1::default_delete<llvm::ToolOutputFile>>>&) + 372
9  firtool                  0x0000000104f85f7c executeFirtool(mlir::MLIRContext&, circt::firtool::FirtoolOptions&) + 956
10 firtool                  0x0000000104f83a68 main + 332
11 dyld                     0x000000018d6260e0 start + 2360
zsh: segmentation fault  firtool crash.fir -mlir-print-ir-before=lower-firrtl-to-hw

seldridge avatar Jul 18 '24 18:07 seldridge

Simple issue, there is an incorrect annotation. This should have a dirname field. However, it doesn't. This then crashes. This should be checked before use.

seldridge avatar Jul 18 '24 19:07 seldridge