From patchwork Thu Mar 1 10:50:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 143986 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 2F29AB6EF3 for ; Thu, 1 Mar 2012 21:50:38 +1100 (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=1331203840; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: From:To:Subject:Message-ID:User-Agent:MIME-Version:Content-Type: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=PXv5NLL+ZF8fRrrTsCDF D1zheTM=; b=UK+XBFgS6Nql6+B38ZxEMwnonfW2UW+1EpOJS62DLsqxTgPnJbBe ABrGtGNgjZjfp89tZd8mpOaxIgnykTkGl5e6+n/a5u/gGE8r8YOB7hbgL686EPsm Y4Lj5goJJMLjFjzd33W+rZ7Lfnssk64j9blWFPsEMoo/fu7ujXWs88U= 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:Date:From:To:Subject:Message-ID:User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=PFApfqFLM+oEL8Qd+sRxzoR99ulyGiV+IrcKvSu4GGNEQLM/BbpQ8Tzh+mgpZK KPIs+hswLWU61WJB9YJCfR1zFo6Jd11IlXGZazHCmuj9vOtdSlsXkYXbpzxdi8A1 rxyhTKR9wfBLv4+ZdFOKULuVDIIyMeecHZmauaYcWkeG4=; Received: (qmail 21739 invoked by alias); 1 Mar 2012 10:50:33 -0000 Received: (qmail 21729 invoked by uid 22791); 1 Mar 2012 10:50:32 -0000 X-SWARE-Spam-Status: No, hits=-5.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 01 Mar 2012 10:50:19 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 6350990072 for ; Thu, 1 Mar 2012 11:50:18 +0100 (CET) Date: Thu, 1 Mar 2012 11:50:18 +0100 (CET) From: Richard Guenther To: gcc-patches@gcc.gnu.org Subject: [PATCH] GIMPLE verification of pointer-int conversions (PR52443) Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 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 should fix PR52443 - it is not necessary to restrict integer to pointer conversions. We do restrict pointer to integer conversions because of the unknown signedness of pointers. There is no reason to do the same for integer to pointer conversions. Bootstrap and regtest on x86_64-unknown-linux-gnu running, but there is only strictly more cases that now return "OK GIMPLE" - so I consider this for trunk at this stage. Richard. 2012-03-01 Richard Guenther PR middle-end/52443 * tree-cfg.c (verify_gimple_assign_unary): Allow any conversions from integral types to pointer types. Index: gcc/tree-cfg.c =================================================================== --- gcc/tree-cfg.c (revision 184688) +++ gcc/tree-cfg.c (working copy) @@ -3340,15 +3429,12 @@ verify_gimple_assign_unary (gimple stmt) { CASE_CONVERT: { - /* Allow conversions between integral types and pointers only if + /* Allow conversions pointer type to integral type only if there is no sign or zero extension involved. For targets were the precision of ptrofftype doesn't match that - of pointers we need to allow arbitrary conversions from and - to ptrofftype. */ + of pointers we need to allow arbitrary conversions to ptrofftype. */ if ((POINTER_TYPE_P (lhs_type) - && INTEGRAL_TYPE_P (rhs1_type) - && (TYPE_PRECISION (lhs_type) >= TYPE_PRECISION (rhs1_type) - || ptrofftype_p (rhs1_type))) + && INTEGRAL_TYPE_P (rhs1_type)) || (POINTER_TYPE_P (rhs1_type) && INTEGRAL_TYPE_P (lhs_type) && (TYPE_PRECISION (rhs1_type) >= TYPE_PRECISION (lhs_type)