Skip to content

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

@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

    missed-warning-or-errorAbsence of an expected error or warning message in the compiler

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions