diff mbox

PR53153

Message ID CABu31nNSdBrqZfbHBoH4Gfvw66o+rPrcYt-XnNW0mQ2eHBXVKQ@mail.gmail.com
State New
Headers show

Commit Message

Steven Bosscher May 2, 2012, 12:58 p.m. UTC
On Wed, May 2, 2012 at 12:14 PM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Wed, May 2, 2012 at 10:32 AM, Steven Bosscher <stevenb.gcc@gmail.com> 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 mbox

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