This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/81194] [8 Regression] ICE during RTL pass: expand
- From: "bergner at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 28 Jun 2017 17:53:25 +0000
- Subject: [Bug rtl-optimization/81194] [8 Regression] ICE during RTL pass: expand
- Auto-submitted: auto-generated
- References: <bug-81194-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81194
--- Comment #10 from Peter Bergner <bergner at gcc dot gnu.org> ---
Created attachment 41647
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41647&action=edit
Proposed patch
(In reply to Richard Biener from comment #9)
> (In reply to Peter Bergner from comment #8)
>> Since there is only one default case statement in stmt, asking for the label
>> at offset "1" is illegal and that leads to the ICE. Either we need to
>> protect this code or maybe we can remove the switch statement all together.
>
> I think we should be defensive here but also take the opportunity to remove
> the switch stmt.
I'm testing the attached patch which fixes the ICE. The cleanup_tree_cfg()
routine can already remove switch statements that only contain a default case
statement, so I have changed the group_case_labels_stmt() to return a boolean
to say whether it eliminated any cases. If after all of the calls to
group_case_labels_stmt(), we detected one of the calls eliminated a case, we
call cleanup_tree_cfg() to possibly remove the switch statement.
richi, does this look ok to you or were you looking for a manual replacement of
the switch with a branch to the lone case label?