Skip to content

Fails to reject parser state transition to non-state label #5304

Open
@jaehyun1ee

Description

@jaehyun1ee

transition statements can specify transition to parser states only. However, the below program is not rejected by p4test.

#include <core.p4>

extern bool ext();

parser P(in bit<6> ttt);
package Pkg(P p);

parser MyParser1(in bit<6> ttt)() {
   state start { transition select(ext()) { true: s1; false: s2; } }
   state s1 { transition ttt; }
   state s2 { transition accept; }
}
Pkg(MyParser1()) main;

After all passes, p4test gives the below IR where the ill-formed transition ttt persists:

#include <core.p4>

extern bool ext();
parser P(in bit<6> ttt);
package Pkg(P p);
parser MyParser1(in bit<6> ttt) {
    @name("MyParser1.tmp_0") bool tmp_0;
    state start {
        tmp_0 = ext();
        transition select((bit<1>)tmp_0) {
            1w1: s1;
            1w0: s2;
            default: noMatch;
        }
    }
    state s1 {
        transition ttt;
    }
    state s2 {
        transition accept;
    }
    state noMatch {
        verify(false, error.NoMatch);
        transition reject;
    }
}

Pkg(MyParser1()) main;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Warnings and ErrorsAbsence of an expected error or warning message in the compilerp4-specTopics related to the P4 specification (https://github.com/p4lang/p4-spec/).

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions