From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 74511 invoked by alias); 15 Nov 2016 16:21:32 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 74446 invoked by uid 89); 15 Nov 2016 16:21:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.7 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=5438 X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 15 Nov 2016 16:21:21 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8C917AD7; Tue, 15 Nov 2016 08:21:19 -0800 (PST) Received: from localhost (e105548-lin.manchester.arm.com [10.45.32.67]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 378B73F24D for ; Tue, 15 Nov 2016 08:21:19 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: Fix handling of unknown sizes in rtx_addr_can_trap_p Date: Tue, 15 Nov 2016 16:21:00 -0000 Message-ID: <8760no3e9u.fsf@e105548-lin.cambridge.arm.com> User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2016-11/txt/msg01475.txt.bz2 If the size passed in to rtx_addr_can_trap_p was zero, the frame handling would get the size from the mode instead. However, this too can be zero if the mode is BLKmode, i.e. if we have a BLKmode memory reference with no MEM_SIZE (which should be rare these days). This meant that the conditions for a 4-byte access at offset X were stricter than those for an access of unknown size at offset X. This patch checks whether the size is still zero, as the SYMBOL_REF handling does. Tested on aarch64-linux-gnu and x86_64-linux-gnu. OK to install? Thanks, Richard [ This patch is part of the SVE series posted here: https://gcc.gnu.org/ml/gcc/2016-11/msg00030.html ] gcc/ 2016-11-15 Richard Sandiford Alan Hayward David Sherwood * rtlanal.c (rtx_addr_can_trap_p_1): Handle unknown sizes. diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index a9d3960..889b14d 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -543,6 +543,8 @@ rtx_addr_can_trap_p_1 (const_rtx x, HOST_WIDE_INT offset, HOST_WIDE_INT size, if (size == 0) size = GET_MODE_SIZE (mode); + if (size == 0) + return 1; if (x == frame_pointer_rtx) {