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

Equal types are always equivalent #3707

Merged
merged 1 commit into from
Jan 7, 2023
Merged

Conversation

mihaibudiu
Copy link
Contributor

Signed-off-by: Mihai Budiu mbudiu@vmware.com
Fixes #3699

Signed-off-by: Mihai Budiu <mbudiu@vmware.com>
@apinski-cavium
Copy link

Hmm, isn't the code in the testcase valid? Or is it just the way constant folding interacts with other passes that causes p4c to reject it too? At one point in the last 6 months, I remembered the testcase working fully too.

@jfingerh
Copy link

If the goal is simply to eliminate the CompilerBug, then it looks like this PR should do that.

@apinski-cavium Are you hoping for a change to the compiler that makes the added test program have no compile-time errors?

@mihaibudiu
Copy link
Contributor Author

If the expression using the mux was used to initialize a const, then this could be a bug.
As it is, I think it's an acceptable behavior of the compiler, although it's not the best user experience really.

@mihaibudiu
Copy link
Contributor Author

@apinski-cavium what do you think, is this a legal behavior?

@mihaibudiu
Copy link
Contributor Author

I think we should merge this anyway, and we can debate about the evaluation order later.

@mihaibudiu mihaibudiu requested a review from fruffy January 6, 2023 23:19
Copy link
Contributor

@jnfoster jnfoster left a comment

Choose a reason for hiding this comment

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

It would be insane for this PR not to be correct.

Now, there may be bugs elsewhere in the compiler, but I agree we should merge this now and deal with any other bugs later.

@mihaibudiu mihaibudiu merged commit 8319722 into p4lang:main Jan 7, 2023
@mihaibudiu mihaibudiu deleted the issue3699 branch January 7, 2023 20:40
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.

Compiler bug with header stacks and constant folding and saturation add
4 participants