Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set headers valid when expanding initializations #2385

Merged
merged 2 commits into from
May 26, 2020

Conversation

mihaibudiu
Copy link
Contributor

Fixes #2383

@@ -77,6 +77,7 @@ parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, inout
@name(".parse_ipv4") state parse_ipv4 {
tmp = packet.lookahead<bit<160>>();
tmp_hdr_0.setValid();
tmp_hdr_0.setValid();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it looks like we get redundant setValid calls in some cases? Harmless, but do we know why this happens?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this happens if the user was already setting the header to valid before assigning to it.
We should write an analysis which can remove the useless setValid; it could probably be folded in the def-use analysis.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #2396

@mihaibudiu mihaibudiu merged commit 2b63775 into p4lang:master May 26, 2020
@mihaibudiu mihaibudiu deleted the issue2383 branch May 26, 2020 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clarification question on uninitialized local headers
2 participants