From patchwork Sat May 10 19:19:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 347720 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D8D85140087 for ; Sun, 11 May 2014 05:19:34 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=KRNb+yk6uPtmqDs9tPqEEb19J7vn85BiUtd2SkUJwY+xn4BYT0Gaz 5KoMbn0PktBvFsF92oNUMUVa8VNkTy1ucReoMkNZRuUFF4BNyc+rJvy/YwltVwE3 KRgWhLmZK9AQTesoc6fhNnyaeWWzpEsgQLZ4iF2xnntQPwpZKPa50I= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=xgtfyVTcK+WF/r77J/vY3AxcIg8=; b=bxe0jQP5+Fz4XzsZDcbT saVcsunkNPxoKoHJwiStzCvdpFZNScXCLcd9OJmLOCcdHHtp0h5egLgJWKrG15kR oZwedZBi/WKnJGZrjSS462mOfFXbvDnCo1JnppDoJRa6v35wa80rq0gzuuHE0KFZ /G9YqY0EaSlcjhrMAEuxoYk= Received: (qmail 8208 invoked by alias); 10 May 2014 19:19:28 -0000 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 Received: (qmail 8198 invoked by uid 89); 10 May 2014 19:19:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-we0-f182.google.com Received: from mail-we0-f182.google.com (HELO mail-we0-f182.google.com) (74.125.82.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 10 May 2014 19:19:26 +0000 Received: by mail-we0-f182.google.com with SMTP id t60so5196768wes.41 for ; Sat, 10 May 2014 12:19:23 -0700 (PDT) X-Received: by 10.180.91.40 with SMTP id cb8mr8715065wib.34.1399749563827; Sat, 10 May 2014 12:19:23 -0700 (PDT) Received: from localhost ([2.26.169.52]) by mx.google.com with ESMTPSA id fs5sm6050022wic.22.2014.05.10.12.19.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 May 2014 12:19:23 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: RFA: Fix type incompatibility in get_addr_base_and_unit_offset_1 Date: Sat, 10 May 2014 20:19:22 +0100 Message-ID: <87mwep1lxh.fsf@talisman.default> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 get_addr_base_and_unit_offset_1 and get_ref_base_and_extent have similar code to handle array indices. The code in tree-dfa.c extends from the precision of the index, as before wide-int, but the tree-dfa.h version was updated in a way that could introduce a type inconsistency (flagged by a patch I'm working on). This version makes them the same again, as per the patch for PR59356. Tested on x86_64-limux-gnu. OK to install? Thanks, Richard gcc/ * tree-dfa.h (get_addr_base_and_unit_offset_1): Update array index calculation to match get_ref_base_and_extent. Index: gcc/tree-dfa.h =================================================================== --- gcc/tree-dfa.h 2014-05-10 14:02:40.112187344 +0100 +++ gcc/tree-dfa.h 2014-05-10 14:02:50.414275258 +0100 @@ -103,7 +103,8 @@ get_addr_base_and_unit_offset_1 (tree ex TREE_CODE (unit_size) == INTEGER_CST)) { offset_int woffset - = offset_int::from (wi::sub (index, low_bound), SIGNED); + = wi::sext (wi::to_offset (index) - wi::to_offset (low_bound), + TYPE_PRECISION (TREE_TYPE (index))); woffset *= wi::to_offset (unit_size); byte_offset += woffset.to_shwi (); }