Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler Bug when value_set is used in a parser select expression #4913

Open
kfcripps opened this issue Sep 15, 2024 · 0 comments
Open

Compiler Bug when value_set is used in a parser select expression #4913

kfcripps opened this issue Sep 15, 2024 · 0 comments
Labels
bug This behavior is unintended and should be fixed. core Topics concerning the core segments of the compiler (frontend, midend, parser)

Comments

@kfcripps
Copy link
Contributor

Building the following P4 program:

#include <core.p4>

parser p(packet_in packet) {
    value_set<bit<16>>(1) vs;
    state start {
        transition select(vs) {
                1: state1;
                default: accept;
        }
    }
    state state1 {
        transition accept;
    }
}

parser simple(packet_in packet);
package top(simple e);
top(p()) main;

results in:

In file: ./frontends/p4/typeChecking/typeCheckExpr.cpp:2264
Compiler Bug: tmp6.p4(6): select{vs} {
  1: state1
  default: accept }: Expected a tuple type for the select expression, got <Type_Set>(1450)<tuple<bit<16>>>
        transition select(vs) {
                   ^
tmp6.p4(6)
        transition select(vs) {
                          ^^

It should result in an error message instead of Compiler Bug.

@kfcripps kfcripps added bug This behavior is unintended and should be fixed. core Topics concerning the core segments of the compiler (frontend, midend, parser) labels Sep 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This behavior is unintended and should be fixed. core Topics concerning the core segments of the compiler (frontend, midend, parser)
Projects
None yet
Development

No branches or pull requests

1 participant