Consider: void bar (void); void foo (int a) { switch (a) { case 4: if (a >= 3 && a <= 5) bar (); } } Note that we could remove the "if" statement, VRP does not catch this. I think Diego already knows about this, but I think it's worth a PR so that we don't forget.
Subject: Re: New: Teach VRP to pick up a constant from case label. On Wed, Apr 27, 2005 at 07:38:04PM -0000, kazu at cs dot umass dot edu wrote: > I think Diego already knows about this, but I think it's worth a PR so that > we don't forget. > Yes, there's a FIXME in tree-vrp.c about not handling SWITCH_EXPR. I agree it's worth having a PR for it. Diego.
Confirmed, in a way PR 20514 is related.
I'm testing a patch.
Kazu is not working on this anymore.
Not working on this anymore.
Mine.
Watch Bug 14495 while you're at it.
Actually, that's very different. This one is about missing ASSERT_EXPRs, the other one is about simplifying SWITCH_EXPRs using the value range of the switch argument.
Subject: Bug 21258 Author: rguenth Date: Fri Apr 13 10:21:22 2007 New Revision: 123778 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=123778 Log: 2007-04-13 Richard Guenther <rguenther@suse.de> PR tree-optimization/21258 * tree-vrp.c (compare_case_labels): New helper. (find_switch_asserts): New function. (find_assert_locations): Call it for SWITCH_EXPRs. * gcc.dg/tree-ssa/vrp34.c: New testcase. Added: trunk/gcc/testsuite/gcc.dg/tree-ssa/vrp34.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-vrp.c
Fixed.