llvm / llvm/circt

[FIRParser] unexpectedly accepting of invalid FIRRTL

Open
#3,273 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

This started with a module definition at the wrong indentation level-- we currently we accept "FIRRTL" like this:

circuit Oops:
  module Oops:
  input in: UInt
  input out: UInt
  wire w: UInt
  w <- in
  out <- w

Producing an empty module "Oops" and discarding the statements.

Poking at things, it seems we even accept things like:

circuit Oops:
  module Oops:
    input in: UInt<1>
    output out: UInt<1>
    out <- in

  asdf:
    dsfa

asdf
input in: UInt
  input out: UInt
  wire w: UInt
  w <- in
  out <- w
  input in: UInt

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

Start at the FIRParser entry point and reproduce the malformed FIRRTL examples in the issue. Trace how invalid indentation and stray content are handled; done means malformed input is rejected rather than accepted with statements silently discarded.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.