From patchwork Wed May 2 12:58:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: PR53153 From: Steven Bosscher X-Patchwork-Id: 156453 Message-Id: To: Richard Guenther Cc: GCC Patches Date: Wed, 2 May 2012 14:58:36 +0200 On Wed, May 2, 2012 at 12:14 PM, Richard Guenther wrote: > On Wed, May 2, 2012 at 10:32 AM, Steven Bosscher wrote: >> Hello, >> >> The attached patch fixes PR53153. >> >> The problem is that tree-ssa-forwprop.c propagates away a cast, but >> leaves out-of-range case labels in the switch. Before my patch for >> r186579, the code in stmt.c would remove such case labels before any >> of the RTL expanders got to see them. After my patch, the gimplifier >> removed those out-of-range labels, but forwprop re-introduces them >> and, en passant, makes the type of the switch index expression >> different from the types of the case label values. >> >> This patch adds splits out the case label preprocessing code in >> gimplify.c to a new function, and makes forwprop use it to update the >> switch label values if it changes the switch index type. >> >> Bootstrapped and tested on x86_64-unknown-linux-gnu. OK for trunk? > > Ok. > > Thanks, > Richard. Thanks, commited as r187048 with one mistake fixed that I noticed while reviewing my own patch: diff -u tree-ssa-forwprop.c tree-ssa-forwprop.c --- tree-ssa-forwprop.c (working copy) +++ tree-ssa-forwprop.c (working copy) @@ -1387,6 +1387,8 @@ } BITMAP_FREE (target_blocks); } + + VEC_free (tree, heap, labels); } /* STMT is a SWITCH_EXPR for which we attempt to find equivalent forms of