This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR tree-optimization/51513
- From: Peter Bergner <bergner at vnet dot ibm dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 29 Apr 2016 07:09:24 -0500
- Subject: Re: [PATCH] Fix PR tree-optimization/51513
- Authentication-results: sourceware.org; auth=none
- References: <1461886509 dot 4256 dot 14 dot camel at vnet dot ibm dot com> <CAFiYyc2yWMnwC5dkOEX+0v5ZkVCatE9RreQtPebcQydxohBR9w at mail dot gmail dot com>
On Fri, 2016-04-29 at 11:56 +0200, Richard Biener wrote:
> Your testcase passes '2' where it passes just fine. If I pass 3 as which
> I indeed get an abort () but you can't reasonably expect it to return 13 then.
Bah, I added an extra case and didn't change the argument. :-(
Let me fix that and then dig into the current behavior.
> So I fail to see the actual bug you are fixing and I wonder why you do stuff
> at the GIMPLE level when we only remove the unreachable blocks at RTL
> level CFG cleanup. Iff then the "fix" should be there.
I actually started out trying to fix the problem in rtl first, but
ran into multiple problems, which at the time made it seem like
fixing this at the GIMPLE level was a better solution.
> But as said, the behavior is expected - in fact the jump-table code should
> be optimized for a unreachable default case to simply omit the range
> check! That would be a better fix (also avoiding the wild branch).
I know I've seen the wild branch due to normal case statements having
__builtin_unreachable() too, so it's not just a default case problem.
That said, I'll have a look to see whether we can fix unreachable
normal case statements too. Thanks.
Peter