Skip to content

Commit

Permalink
Add tests from issue 4507 (#4816)
Browse files Browse the repository at this point in the history
Signed-off-by: Kyle Cripps <[email protected]>
  • Loading branch information
kfcripps authored Jul 18, 2024
1 parent 0dc923d commit 5765791
Show file tree
Hide file tree
Showing 12 changed files with 299 additions and 0 deletions.
35 changes: 35 additions & 0 deletions testdata/p4_16_samples/issue4507_1.p4
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
extern void __e(in bit<28> arg);
extern void __e2(in bit<28> arg);

control C() {
action bar(bool a, bool b) {
bit<28> x; bit<28> y;
if (a) {
if (b) {
__e(x);
}
} else {
if (b) {
__e2(y);
}
}
}

action foo() {
bar(true, false);
}

table t {
actions = { foo; }
default_action = foo;
}

apply {
t.apply();
}
}

control proto();
package top(proto p);

top(C()) main;
40 changes: 40 additions & 0 deletions testdata/p4_16_samples/issue4507_2.p4
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
extern void __e(in bit<28> arg);
extern void __e2(in bit<28> arg);

control C() {
action bar(bool a, bool b) {
bit<28> x; bit<28> y;
if (a) {
if (b) {
__e(x);
}
} else {
if (b) {
__e2(y);
}
}
}

action baz() {
bar(true, false);
}

action foo() {
baz();
baz();
}

table t {
actions = { foo; }
default_action = foo;
}

apply {
t.apply();
}
}

control proto();
package top(proto p);

top(C()) main;
31 changes: 31 additions & 0 deletions testdata/p4_16_samples_outputs/issue4507_1-first.p4
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
extern void __e(in bit<28> arg);
extern void __e2(in bit<28> arg);
control C() {
action bar(bool a, bool b) {
bit<28> x;
bit<28> y;
if (a) {
if (b) {
__e(x);
}
} else if (b) {
__e2(y);
}
}
action foo() {
bar(true, false);
}
table t {
actions = {
foo();
}
default_action = foo();
}
apply {
t.apply();
}
}

control proto();
package top(proto p);
top(C()) main;
19 changes: 19 additions & 0 deletions testdata/p4_16_samples_outputs/issue4507_1-frontend.p4
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
extern void __e(in bit<28> arg);
extern void __e2(in bit<28> arg);
control C() {
@name("C.foo") action foo() {
}
@name("C.t") table t_0 {
actions = {
foo();
}
default_action = foo();
}
apply {
t_0.apply();
}
}

control proto();
package top(proto p);
top(C()) main;
19 changes: 19 additions & 0 deletions testdata/p4_16_samples_outputs/issue4507_1-midend.p4
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
extern void __e(in bit<28> arg);
extern void __e2(in bit<28> arg);
control C() {
@name("C.foo") action foo() {
}
@name("C.t") table t_0 {
actions = {
foo();
}
default_action = foo();
}
apply {
t_0.apply();
}
}

control proto();
package top(proto p);
top(C()) main;
33 changes: 33 additions & 0 deletions testdata/p4_16_samples_outputs/issue4507_1.p4
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
extern void __e(in bit<28> arg);
extern void __e2(in bit<28> arg);
control C() {
action bar(bool a, bool b) {
bit<28> x;
bit<28> y;
if (a) {
if (b) {
__e(x);
}
} else {
if (b) {
__e2(y);
}
}
}
action foo() {
bar(true, false);
}
table t {
actions = {
foo;
}
default_action = foo;
}
apply {
t.apply();
}
}

control proto();
package top(proto p);
top(C()) main;
6 changes: 6 additions & 0 deletions testdata/p4_16_samples_outputs/issue4507_1.p4-stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
issue4507_1.p4(9): [--Wwarn=uninitialized_use] warning: x may be uninitialized
__e(x);
^
issue4507_1.p4(13): [--Wwarn=uninitialized_use] warning: y may be uninitialized
__e2(y);
^
35 changes: 35 additions & 0 deletions testdata/p4_16_samples_outputs/issue4507_2-first.p4
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
extern void __e(in bit<28> arg);
extern void __e2(in bit<28> arg);
control C() {
action bar(bool a, bool b) {
bit<28> x;
bit<28> y;
if (a) {
if (b) {
__e(x);
}
} else if (b) {
__e2(y);
}
}
action baz() {
bar(true, false);
}
action foo() {
baz();
baz();
}
table t {
actions = {
foo();
}
default_action = foo();
}
apply {
t.apply();
}
}

control proto();
package top(proto p);
top(C()) main;
19 changes: 19 additions & 0 deletions testdata/p4_16_samples_outputs/issue4507_2-frontend.p4
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
extern void __e(in bit<28> arg);
extern void __e2(in bit<28> arg);
control C() {
@name("C.foo") action foo() {
}
@name("C.t") table t_0 {
actions = {
foo();
}
default_action = foo();
}
apply {
t_0.apply();
}
}

control proto();
package top(proto p);
top(C()) main;
19 changes: 19 additions & 0 deletions testdata/p4_16_samples_outputs/issue4507_2-midend.p4
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
extern void __e(in bit<28> arg);
extern void __e2(in bit<28> arg);
control C() {
@name("C.foo") action foo() {
}
@name("C.t") table t_0 {
actions = {
foo();
}
default_action = foo();
}
apply {
t_0.apply();
}
}

control proto();
package top(proto p);
top(C()) main;
37 changes: 37 additions & 0 deletions testdata/p4_16_samples_outputs/issue4507_2.p4
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
extern void __e(in bit<28> arg);
extern void __e2(in bit<28> arg);
control C() {
action bar(bool a, bool b) {
bit<28> x;
bit<28> y;
if (a) {
if (b) {
__e(x);
}
} else {
if (b) {
__e2(y);
}
}
}
action baz() {
bar(true, false);
}
action foo() {
baz();
baz();
}
table t {
actions = {
foo;
}
default_action = foo;
}
apply {
t.apply();
}
}

control proto();
package top(proto p);
top(C()) main;
6 changes: 6 additions & 0 deletions testdata/p4_16_samples_outputs/issue4507_2.p4-stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
issue4507_2.p4(9): [--Wwarn=uninitialized_use] warning: x may be uninitialized
__e(x);
^
issue4507_2.p4(13): [--Wwarn=uninitialized_use] warning: y may be uninitialized
__e2(y);
^

0 comments on commit 5765791

Please sign in to comment.