oxidecomputer / oxidecomputer/p4

Variable initialization overrides variable type.

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

Nobody has claimed this yet.

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

Description

This code

bit<16> x = 0;

results in an internal compiler type for x that is 128 bits wide since constants without a width specifier default to 128-bit values.

  • Came up in #35
  • Related to #29
  • Related to #34

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 tracing how typed bit declarations and unsuffixed constants are represented in the compiler, using the behavior described here as the reproduction. Review issues #35, #29, and #34 for related context. Done means bit<16> x = 0 retains a 16-bit internal type rather than becoming 128 bits wide.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.