p4c icon indicating copy to clipboard operation
p4c copied to clipboard

Equal types are always equivalent

Open mihaibudiu opened this issue 2 years ago • 4 comments

Signed-off-by: Mihai Budiu [email protected] Fixes #3699

mihaibudiu avatar Nov 19 '22 02:11 mihaibudiu

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.

apinski-cavium avatar Nov 19 '22 03:11 apinski-cavium

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?

jfingerh avatar Nov 19 '22 15:11 jfingerh

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 avatar Nov 21 '22 19:11 mihaibudiu

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

mihaibudiu avatar Nov 23 '22 17:11 mihaibudiu

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

mihaibudiu avatar Jan 06 '23 23:01 mihaibudiu