-
Notifications
You must be signed in to change notification settings - Fork 497
Open
Labels
coreTopics concerning the core segments of the compiler (frontend, midend, parser)Topics concerning the core segments of the compiler (frontend, midend, parser)
Description
The compilation of the following code fails with a compiler bug.
/*
Copyright 2013-present Barefoot Networks, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include <core.p4>
#include <v1model.p4>
header hdr {
int<32> a;
bit<8> b;
int<64> c;
}
type bit<8> shiftEnum;
#include "../p4_16_samples/arith-skeleton.p4"
control ingress(inout Headers h, inout Meta m, inout standard_metadata_t sm) {
action shift(in shiftEnum e)
{
// This should not be allowed. However, for backwards compatibility,
// it is, as discussed in the issue #5100.
h.h.c = (int<64>)(h.h.a << e);
sm.egress_spec = 0;
}
table t {
actions = { shift((shiftEnum)0); }
const default_action = shift((shiftEnum)0);
}
apply { t.apply(); }
}
V1Switch(p(), vrfy(), ingress(), egress(), update(), deparser()) main;
Compiler bug:
Error compiling
In file: /root/repos/git9a-p4c/frontends/p4/typeMap.cpp:118
Compiler Bug: Could not find type for <Type_Newtype>(11052) shiftEnum/63
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
coreTopics concerning the core segments of the compiler (frontend, midend, parser)Topics concerning the core segments of the compiler (frontend, midend, parser)