oxidecomputer / oxidecomputer/p4

Variables without initializers cause invalid code generation.

Open
#34 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug codegen
Dominant language
Rust
Stars
137
Forks
12
Avg merge
4d 22h
Merged PRs (30d)
3

Description

The following works fine.

bit<32> x = 0;

However, the following causes bad code generation

bit<32> x;

According to the P4 spec section 11.2, variable initializers are optional, so this should be accepted by the front end and generate valid code.

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 by reproducing the two P4 declarations from the issue and compare the generated output. Trace the compiler's front-end handling and code-generation path for variables without initializers; done means the uninitialized declaration is accepted and produces valid code consistent with P4 specification section 11.2.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.