Skip to content

Commit bd618c5

Browse files
authored
Add back test case for #5333 (#5351)
Signed-off-by: Kyle Cripps <[email protected]>
1 parent 4d0e0da commit bd618c5

File tree

6 files changed

+119
-0
lines changed

6 files changed

+119
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
extern void __e(in bit<16> x);
2+
control C(in bit<16> x) {
3+
action a3(bit<16> y) {
4+
__e(y);
5+
}
6+
7+
action a2(bit<6> y) {
8+
a3(x << (9 + y));
9+
}
10+
11+
action a() {
12+
a2(9);
13+
}
14+
15+
table t {
16+
actions = { a; }
17+
default_action = a;
18+
}
19+
20+
apply {
21+
t.apply();
22+
}
23+
}
24+
25+
control proto(in bit<16> x);
26+
package top(proto p);
27+
28+
top(C()) main;
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
extern void __e(in bit<16> x);
2+
control C(in bit<16> x) {
3+
action a3(bit<16> y) {
4+
__e(y);
5+
}
6+
action a2(bit<6> y) {
7+
a3(x << 6w9 + y);
8+
}
9+
action a() {
10+
a2(6w9);
11+
}
12+
table t {
13+
actions = {
14+
a();
15+
}
16+
default_action = a();
17+
}
18+
apply {
19+
t.apply();
20+
}
21+
}
22+
23+
control proto(in bit<16> x);
24+
package top(proto p);
25+
top(C()) main;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
extern void __e(in bit<16> x);
2+
control C(in bit<16> x) {
3+
@name("C.a") action a() {
4+
__e(x << 6w18);
5+
}
6+
@name("C.t") table t_0 {
7+
actions = {
8+
a();
9+
}
10+
default_action = a();
11+
}
12+
apply {
13+
t_0.apply();
14+
}
15+
}
16+
17+
control proto(in bit<16> x);
18+
package top(proto p);
19+
top(C()) main;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
extern void __e(in bit<16> x);
2+
control C(in bit<16> x) {
3+
@name("C.a") action a() {
4+
__e(x << 6w18);
5+
}
6+
@name("C.t") table t_0 {
7+
actions = {
8+
a();
9+
}
10+
default_action = a();
11+
}
12+
apply {
13+
t_0.apply();
14+
}
15+
}
16+
17+
control proto(in bit<16> x);
18+
package top(proto p);
19+
top(C()) main;
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
extern void __e(in bit<16> x);
2+
control C(in bit<16> x) {
3+
action a3(bit<16> y) {
4+
__e(y);
5+
}
6+
action a2(bit<6> y) {
7+
a3(x << 9 + y);
8+
}
9+
action a() {
10+
a2(9);
11+
}
12+
table t {
13+
actions = {
14+
a;
15+
}
16+
default_action = a;
17+
}
18+
apply {
19+
t.apply();
20+
}
21+
}
22+
23+
control proto(in bit<16> x);
24+
package top(proto p);
25+
top(C()) main;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
issue5331_srcinfo.p4(4): [--Wwarn=overflow] warning: x << 18: shifting value with 16 bits by 18
2+
__e(y);
3+
^

0 commit comments

Comments
 (0)