-
Notifications
You must be signed in to change notification settings - Fork 449
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
simplifyDefUse: Report the specific uninitialized struct field (#4892)
Rather than reporting the whole struct, report the specific field(s) that is(are) uninitialized. Signed-off-by: Chris Dodd <cdodd@nvidia.com> Co-authored-by: Alexander Efimov <aefimov@nvidia.com>
- Loading branch information
1 parent
0b90b08
commit 8ba8c3c
Showing
22 changed files
with
63 additions
and
42 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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
annotation-bug.p4(24): [--Wwarn=uninitialized_use] warning: hdr.ipv4_option_timestamp may not be completely initialized | ||
annotation-bug.p4(24): [--Wwarn=uninitialized_use] warning: hdr.ipv4_option_timestamp.len may be uninitialized | ||
get<headers>({ hdr.ipv4_option_timestamp }); | ||
^^^^^^^^^^^^^^^^^^^^^^^^^ |
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
2 changes: 1 addition & 1 deletion
2
testdata/p4_16_samples_outputs/gauntlet_hdr_out_in_action-bmv2.p4-stderr
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
gauntlet_hdr_out_in_action-bmv2.p4(35): [--Wwarn=unused] warning: 'val' is unused | ||
action do_action(out ethernet_t val) { | ||
^^^ | ||
gauntlet_hdr_out_in_action-bmv2.p4(35): [--Wwarn=uninitialized_use] warning: val may not be completely initialized | ||
gauntlet_hdr_out_in_action-bmv2.p4(35): [--Wwarn=uninitialized_use] warning: val.dst_addr may be uninitialized | ||
action do_action(out ethernet_t val) { | ||
^^^ |
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
3 changes: 2 additions & 1 deletion
3
testdata/p4_16_samples_outputs/gauntlet_invalid_hdr_assign-bmv2.p4-stderr
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
[--Wwarn=uninitialized_use] warning: tmp_0 may not be completely initialized | ||
[--Wwarn=uninitialized_use] warning: tmp_0.a may be uninitialized | ||
[--Wwarn=uninitialized_use] warning: tmp_0.b may be uninitialized | ||
gauntlet_invalid_hdr_assign-bmv2.p4(39): [--Wwarn=invalid_header] warning: accessing a field of a potentially invalid header h.h | ||
h.eth_hdr.eth_type = (bit<16>)h.h.a; | ||
^^^ |
12 changes: 9 additions & 3 deletions
12
testdata/p4_16_samples_outputs/gauntlet_invalid_hdr_short_circuit-bmv2.p4-stderr
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 |
---|---|---|
@@ -1,3 +1,9 @@ | ||
[--Wwarn=uninitialized_use] warning: dummy_0 may not be completely initialized | ||
[--Wwarn=uninitialized_use] warning: dummy_0 may not be completely initialized | ||
[--Wwarn=uninitialized_use] warning: dummy_0 may not be completely initialized | ||
[--Wwarn=uninitialized_use] warning: dummy_0.a may be uninitialized | ||
[--Wwarn=uninitialized_use] warning: dummy_0.b may be uninitialized | ||
[--Wwarn=uninitialized_use] warning: dummy_0.c may be uninitialized | ||
[--Wwarn=uninitialized_use] warning: dummy_0.a may be uninitialized | ||
[--Wwarn=uninitialized_use] warning: dummy_0.b may be uninitialized | ||
[--Wwarn=uninitialized_use] warning: dummy_0.c may be uninitialized | ||
[--Wwarn=uninitialized_use] warning: dummy_0.a may be uninitialized | ||
[--Wwarn=uninitialized_use] warning: dummy_0.b may be uninitialized | ||
[--Wwarn=uninitialized_use] warning: dummy_0.c may be uninitialized |
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
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
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
issue1897-bmv2.p4(40): [--Wwarn=uninitialized_use] warning: addr_0 may not be completely initialized | ||
issue1897-bmv2.p4(40): [--Wwarn=uninitialized_use] warning: addr_0.ipv4 may be uninitialized | ||
out addr_t addr) { | ||
^^^^ |
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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
issue1955.p4(84): [--Wwarn=uninitialized_use] warning: hdr.ethernet_1 may not be completely initialized | ||
issue1955.p4(84): [--Wwarn=uninitialized_use] warning: hdr.ethernet_1.dstAddr may be uninitialized | ||
p1.apply(packet, hdr.ethernet_1, hdr.ipv4_1); | ||
^^^^^^^^^^^^^^ | ||
issue1955.p4(84): [--Wwarn=uninitialized_use] warning: hdr.ipv4_1 may not be completely initialized | ||
issue1955.p4(84): [--Wwarn=uninitialized_use] warning: hdr.ipv4_1.version may be uninitialized | ||
p1.apply(packet, hdr.ethernet_1, hdr.ipv4_1); | ||
^^^^^^^^^^ | ||
issue1955.p4(85): [--Wwarn=uninitialized_use] warning: hdr.ethernet_2 may not be completely initialized | ||
issue1955.p4(85): [--Wwarn=uninitialized_use] warning: hdr.ethernet_2.dstAddr may be uninitialized | ||
p2.apply(packet, hdr.ethernet_2, hdr.ipv4_2); | ||
^^^^^^^^^^^^^^ | ||
issue1955.p4(85): [--Wwarn=uninitialized_use] warning: hdr.ipv4_2 may not be completely initialized | ||
issue1955.p4(85): [--Wwarn=uninitialized_use] warning: hdr.ipv4_2.version may be uninitialized | ||
p2.apply(packet, hdr.ethernet_2, hdr.ipv4_2); | ||
^^^^^^^^^^ |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
issue2314.p4(71): [--Wwarn=uninitialized_use] warning: hdr may not be completely initialized | ||
issue2314.p4(71): [--Wwarn=uninitialized_use] warning: hdr.h may be uninitialized | ||
l3.apply(b, hdr); | ||
^^^ |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
issue2957.p4(23): [--Wwarn=uninitialized_use] warning: hdr.h[tmp_3] may not be completely initialized | ||
issue2957.p4(23): [--Wwarn=uninitialized_use] warning: hdr.h[tmp_3].a may be uninitialized | ||
H tmp = { extern_call(hdr.h[max(3w1, 3w2)]) }; | ||
^^^^^^^^^^^^^^^^^^^^ |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
issue3001.p4(23): [--Wwarn=uninitialized_use] warning: h may not be completely initialized | ||
issue3001.p4(23): [--Wwarn=uninitialized_use] warning: h.x may be uninitialized | ||
return h; | ||
^ |
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
2 changes: 1 addition & 1 deletion
2
testdata/p4_16_samples_outputs/parser-inline/parser-inline-test13.p4-stderr
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
parser-inline-test13.p4(32): [--Wwarn=uninitialized_use] warning: hdr_0 may not be completely initialized | ||
parser-inline-test13.p4(32): [--Wwarn=uninitialized_use] warning: hdr_0.h2 may be uninitialized | ||
out headers hdr, | ||
^^^ |
2 changes: 1 addition & 1 deletion
2
testdata/p4_16_samples_outputs/subparser-with-header-stack-bmv2.p4-stderr
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
subparser-with-header-stack-bmv2.p4(84): [--Wwarn=uninitialized_use] warning: hdr may not be completely initialized | ||
subparser-with-header-stack-bmv2.p4(84): [--Wwarn=uninitialized_use] warning: hdr.h2 may be uninitialized | ||
subp.apply(pkt, hdr, my_next_hdr_type); | ||
^^^ |
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