From patchwork Wed Jul 18 14:05:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 171685 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 41E4E2C007F for ; Thu, 19 Jul 2012 00:07:11 +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=1343225244; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Subject:Date:User-Agent:MIME-Version: Content-Type:Message-Id:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=At25SnXkWgQ88xO5UFy/fDJC4vo=; b=cb5XlZhlEtlwV/s DETtpWs7/0kKEv5eCJC7hSjOCdBW8pNd2xfEOki9KsGEg6d63rbbatztvZHP0274 6oKP/v4tZYIcXrTnuXjqXIM/x7Pc56jTfePz3lAWjWv4wFr65hYYOiDTm9FKe0Jt ef49OazH6L5NHINejoJX0flkRWYw= 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:Received:Received:From:To:Subject:Date:User-Agent:MIME-Version:Content-Type:Message-Id:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=tcL+VuSbd3kriAOFG2vIeXvHrXvqf9Q7lp2j/o95/SP5YmFW0a3Xb9gSDpfvS6 FimWpGoGmwoN0KjPFddxyBaUQivGE2dSOf9gPYk3XKSgw2NoIsLuyoggeo6fBGyb wnhN+Dt9mZ9zmEfdKAAI7V3T7rRaMbeV6uSjoUnnXbWoc=; Received: (qmail 27804 invoked by alias); 18 Jul 2012 14:06:35 -0000 Received: (qmail 27790 invoked by uid 22791); 18 Jul 2012 14:06:34 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 18 Jul 2012 14:06:20 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id B6508290059 for ; Wed, 18 Jul 2012 16:06:24 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id luRwBTXfM2cJ for ; Wed, 18 Jul 2012 16:06:24 +0200 (CEST) Received: from hermes.site (ADijon-552-1-101-157.w90-33.abo.wanadoo.fr [90.33.60.157]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 752C2290053 for ; Wed, 18 Jul 2012 16:06:24 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [patch] Fix ICE in set_lattice_value Date: Wed, 18 Jul 2012 16:05:08 +0200 User-Agent: KMail/1.13.5 (Linux/2.6.34.10-0.6-desktop; KDE/4.4.4; x86_64; ; ) MIME-Version: 1.0 Message-Id: <201207181605.08990.ebotcazou@adacore.com> 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 This is a regression present on mainline and 4.7 branch for targets using SJLJ exceptions by default in Ada (e.g. ARM). The error message is: +===========================GNAT BUG DETECTED==============================+ | 4.8.0 20120716 (experimental) [trunk revision 189525] (x86_64-suse-linux) GCC error:| | in set_lattice_value, at tree-ssa-ccp.c:452 | | Error detected around p.adb:16:4 It's valid_lattice_transition returning false on a transition from INTEGER_CST to a constant &x. It occurs for an array reference with non-constant index: on the first round, &x + i is non-constant so the algorithm computes an alignment factor which is an INTEGER_CST; on the second round, i is 0 so the new value is the constant &x. valid_lattice_transition accepts the reverse transition. The attached patch makes the function accept this transition as well. Tested on x86_64-suse-linux, OK for the mainline and 4.7 branch? 2012-07-18 Eric Botcazou * tree-ssa-ccp.c (valid_lattice_transition): Allow transitioning from as well as to INTEGER_CST. 2012-07-18 Eric Botcazou * gnat.dg/loop_optimization11.adb: New test. * gnat.dg/loop_optimization11_pkg.ads: New helper. Index: tree-ssa-ccp.c =================================================================== --- tree-ssa-ccp.c (revision 189525) +++ tree-ssa-ccp.c (working copy) @@ -405,9 +405,9 @@ valid_lattice_transition (prop_value_t o /* Now both lattice values are CONSTANT. */ - /* Allow transitioning from &x to &x & ~3. */ - if (TREE_CODE (old_val.value) != INTEGER_CST - && TREE_CODE (new_val.value) == INTEGER_CST) + /* Allow transitioning from &x to &x & ~3 and vice versa. */ + if ((TREE_CODE (old_val.value) == INTEGER_CST) + != (TREE_CODE (new_val.value) == INTEGER_CST)) return true; /* Bit-lattices have to agree in the still valid bits. */