From patchwork Wed May 2 12:58:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Bosscher X-Patchwork-Id: 156453 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id B283DB6FAF for ; Wed, 2 May 2012 22:58:55 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1336568336; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Received:Received:In-Reply-To:References:Date: Message-ID:Subject:From:To:Cc:Content-Type:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=WVT9sj3PbQHAJfLyS917oLMOlPg=; b=lYDPmiYIXZkVzrOrd7wBC2836xiOHgbh1oymyUkJyQ2aDpjNd2zxEkEZWIpq3N nuiGp4qzpIfBGAhMnQgaHtFuloEURj0Ru1KV8ylXgpEK6KIMMOviRjzP3bY4Jyqt U2JEg24zKWkoi2gonFMLmM+oZACiC7Lxo7ms6aAWgUhCA= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:MIME-Version:Received:Received:In-Reply-To:References:Date:Message-ID:Subject:From:To:Cc:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=pP/qvMHy+7YEdjMpC0VdDP/22WPaEKYpR3nRHPw29n8DzVzqHDdfPHnq/RmB5O 2CalvBWpDVFDMdNcUgpTg7iKkdmWhJ2T05ZmhyESM6zwDL6J0jWOXVHfH8fO9Qcd GxQ4++WP44BlZ+EB7N7/5GuuFu0T63AB45J7Wu6Suwl2A=; Received: (qmail 14996 invoked by alias); 2 May 2012 12:58:52 -0000 Received: (qmail 14987 invoked by uid 22791); 2 May 2012 12:58:51 -0000 X-SWARE-Spam-Status: No, hits=-4.8 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-gy0-f175.google.com (HELO mail-gy0-f175.google.com) (209.85.160.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 02 May 2012 12:58:37 +0000 Received: by ghbz2 with SMTP id z2so709010ghb.20 for ; Wed, 02 May 2012 05:58:37 -0700 (PDT) MIME-Version: 1.0 Received: by 10.236.170.71 with SMTP id o47mr27863243yhl.104.1335963517041; Wed, 02 May 2012 05:58:37 -0700 (PDT) Received: by 10.100.90.6 with HTTP; Wed, 2 May 2012 05:58:36 -0700 (PDT) In-Reply-To: References: Date: Wed, 2 May 2012 14:58:36 +0200 Message-ID: Subject: Re: [patch] PR53153 From: Steven Bosscher To: Richard Guenther Cc: GCC Patches X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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