Misoptimization of case with string compares #1536
Comments
Original Redmine Comment Thanks for the good test case. What's going on is when the case statement is getting optimized it treated the different result strings as matching when they shouldn't. Also added a boat-load of assertions to check for similar missing string cases, but nothing turned up in existing regressions. Fixed in git towards eventual 4.020 release. |
Original Redmine Comment Confirmed fixed. Thanks Wilson for the quick fix! |
Original Redmine Comment In 4.020. Thanks for reporting this; if there are additional related problems, please open a new issue. |
Author Name: Philipp Wagner
Original Redmine Issue: 1536 from https://www.veripool.org
Original Assignee: Wilson Snyder (@wsnyder)
I have (simplified) code like this:
When I compile without WITH_DEFAULT being set, everything works as expected, and I get output like this:
But if I compile with WITH_DEFAULT set, I get this output; effectively, the default label is always taken.
The same behavior can be observed if I switch from case to if statements.
I put together a full testcase at https://github.com/imphil/verilator-case, it can be run by typing make.
The full code where we observed this behavior is at https://github.com/lowRISC/ibex/blob/2acb497d22a5da877a9c4350ef5693d0c767cc61/rtl/ibex_tracer.sv#L584
Looking at the generated C code, it looks like somehow the if/case statements get optimized out when compiling with default/else branches.
I'd appreciate any pointers on how to debug this further.
The text was updated successfully, but these errors were encountered: