You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#include <v1model.p4>
struct h { }
struct m { }
parser MyParser(packet_in b, out h hdr, inout m meta, inout standard_metadata_t std) {
bit<16> counter;
state start {
counter = 0;
transition accept;
}
}
control MyVerifyChecksum(in h hdr, inout m meta) {
apply {}
}
control MyIngress(inout h hdr, inout m meta, inout standard_metadata_t std) {
apply { }
}
control MyEgress(inout h hdr, inout m meta, inout standard_metadata_t std) {
apply { }
}
control MyComputeChecksum(inout h hdr, inout m meta) {
apply {}
}
control MyDeparser(packet_out b, in h hdr) {
apply { }
}
V1Switch(MyParser(), MyVerifyChecksum(), MyIngress(), MyEgress(), MyComputeChecksum(), MyDeparser()) main;
But if I rename the local variable counter to something else, it works fine:
#include <v1model.p4>
struct h { }
struct m { }
parser MyParser(packet_in b, out h hdr, inout m meta, inout standard_metadata_t std) {
bit<16> i;
state start {
i = 0;
transition accept;
}
}
control MyVerifyChecksum(in h hdr, inout m meta) {
apply {}
}
control MyIngress(inout h hdr, inout m meta, inout standard_metadata_t std) {
apply { }
}
control MyEgress(inout h hdr, inout m meta, inout standard_metadata_t std) {
apply { }
}
control MyComputeChecksum(inout h hdr, inout m meta) {
apply {}
}
control MyDeparser(packet_out b, in h hdr) {
apply { }
}
V1Switch(MyParser(), MyVerifyChecksum(), MyIngress(), MyEgress(), MyComputeChecksum(), MyDeparser()) main;
Should the parser update structure when a new variable is declared? It currently doesn't:
variableDeclaration
: annotations typeRef name optInitializer ';'
{ auto ann = new IR::Annotations(@1, $1);
$$ = new IR::Declaration_Variable(@1+@4, *$3, ann, $2, $4); }
| typeRef name optInitializer ';'
{ $$ = new IR::Declaration_Variable(
@1+@4, *$2, IR::Annotations::empty, $1, $3);}
;
The text was updated successfully, but these errors were encountered:
Compiling the following program,
produces an error:
But if I rename the local variable
counter
to something else, it works fine:Should the parser update
structure
when a new variable is declared? It currently doesn't:The text was updated successfully, but these errors were encountered: