-
Notifications
You must be signed in to change notification settings - Fork 448
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle correctly general switch statements when simplifying (#3624)
* Handle correctly general switch statements when simplifying * Properly handle side-effects when removing switch statements Signed-off-by: Mihai Budiu <mbudiu@vmware.com>
- Loading branch information
Mihai Budiu
authored
Nov 2, 2022
1 parent
97cffff
commit 31e2d5f
Showing
12 changed files
with
95 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
bit<4> f(in bit<4> d) { | ||
return d; | ||
} | ||
|
||
control c(in bit<4> v) { | ||
apply { | ||
switch(f(v)) { | ||
} | ||
} | ||
} | ||
|
||
control C(in bit<4> b); | ||
package top(C c); | ||
|
||
top(c()) main; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
control c(in bit<4> v) { | ||
apply { | ||
switch(v) { | ||
default: | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
bit<4> f(in bit<4> d) { | ||
return d; | ||
} | ||
control c(in bit<4> v) { | ||
apply { | ||
switch (f(v)) { | ||
} | ||
} | ||
} | ||
|
||
control C(in bit<4> b); | ||
package top(C c); | ||
top(c()) main; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
control c(in bit<4> v) { | ||
apply { | ||
} | ||
} | ||
|
||
control C(in bit<4> b); | ||
package top(C c); | ||
top(c()) main; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
control c(in bit<4> v) { | ||
apply { | ||
} | ||
} | ||
|
||
control C(in bit<4> b); | ||
package top(C c); | ||
top(c()) main; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
bit<4> f(in bit<4> d) { | ||
return d; | ||
} | ||
control c(in bit<4> v) { | ||
apply { | ||
switch (f(v)) { | ||
} | ||
} | ||
} | ||
|
||
control C(in bit<4> b); | ||
package top(C c); | ||
top(c()) main; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
control c(in bit<4> v) { | ||
apply { | ||
} | ||
} | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
control c(in bit<4> v) { | ||
apply { | ||
switch (v) { | ||
default: | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
issue3619.p4(4): [--Wwarn=missing] warning: SwitchCase: fallthrough with no statement | ||
default: | ||
^^^^^^^ | ||
[--Wwarn=missing] warning: Program does not contain a `main' module |