Patchwork PR53153

mail settings
Submitter Steven Bosscher
Date May 2, 2012, 12:58 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/156453/
State New
Headers show


Steven Bosscher - May 2, 2012, 12:58 p.m.
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