Skip to content

Fix enum constant assignments to locals - #102

Merged
r41k0u merged 2 commits into
masterfrom
fix/enum-constant-local
Sep 18, 2026
Merged

r41k0u merged 2 commits into
masterfrom
fix/enum-constant-local

Conversation

@r41k0u

@r41k0u r41k0u commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

r41k0u and others added 2 commits September 18, 2026 13:41
Every read of a bare name resolves local, then BPF global, then vmlinux
enum constant, except the allocation pass's variable-to-variable path,
which stopped after the globals and rejected `act = XDP_PASS` with
"source variable not found", while `act = XDP_PASS + 0` compiled through
the binop path. The error text pointed the wrong way: it is the target
that needs a stack slot, and the pass could not type it. An enum
constant is an immediate with no storage of its own, so the target gets
the i64 slot a literal gets, and the constant is folded at the store.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
failing_tests/vmlinux/assignment_handling.py pinned exactly this gap
("This gives an error, but / this does not"); it moves to the passing
suite and its xfail entry goes. enum_to_local.py adds the C shape
`int act = XDP_PASS; if (...) act = XDP_DROP; return act;`.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@r41k0u
r41k0u merged commit a949a90 into master Sep 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant