From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11631 invoked by alias); 15 Nov 2017 07:31:04 -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 11524 invoked by uid 89); 15 Nov 2017 07:31:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.7 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KB_WAM_FROM_NAME_SINGLEWORD,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1185 X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 15 Nov 2017 07:31:02 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 92DBBAAC7; Wed, 15 Nov 2017 07:31:00 +0000 (UTC) Subject: Re: [PATCH] Fix UBSAN errors in dse.c (PR rtl-optimization/82044). To: Jeff Law , Jakub Jelinek Cc: gcc-patches@gcc.gnu.org References: <20170920081519.GU1701@tucnak> <7cff6742-bd7a-5ea2-80fb-aca74610f591@suse.cz> <7e976ae2-4aab-9abd-1990-94b9804db8f9@redhat.com> From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Message-ID: <87d09716-916c-974f-9a4e-7fa95f6b97c3@suse.cz> Date: Wed, 15 Nov 2017 07:34:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <7e976ae2-4aab-9abd-1990-94b9804db8f9@redhat.com> Content-Type: multipart/mixed; boundary="------------563F5F42E8942D846BDFCB36" X-IsSubscribed: yes X-SW-Source: 2017-11/txt/msg01161.txt.bz2 This is a multi-part message in MIME format. --------------563F5F42E8942D846BDFCB36 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-length: 251 On 11/08/2017 05:31 PM, Jeff Law wrote: > I don't see an updated patch in this thread? THe last message I see is > this one where you indicate you're going to tweak the patch and re-test. > > Jeff Yes, I tweaked and tested following patch. Martin --------------563F5F42E8942D846BDFCB36 Content-Type: text/x-patch; name="0001-Fix-UBSAN-errors-in-dse.c-PR-rtl-optimization-82044.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Fix-UBSAN-errors-in-dse.c-PR-rtl-optimization-82044.pat"; filename*1="ch" Content-length: 911 >From a369ac78b887e219a375e17d6817c1f744e71779 Mon Sep 17 00:00:00 2001 From: marxin Date: Thu, 19 Oct 2017 13:38:01 +0200 Subject: [PATCH] Fix UBSAN errors in dse.c (PR rtl-optimization/82044). gcc/ChangeLog: 2017-10-19 Martin Liska PR rtl-optimization/82044 PR tree-optimization/82042 * dse.c (check_mem_read_rtx): Check for overflow. --- gcc/dse.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gcc/dse.c b/gcc/dse.c index 563ca9f56f3..f6d5e6e6fe2 100644 --- a/gcc/dse.c +++ b/gcc/dse.c @@ -1981,6 +1981,12 @@ check_mem_read_rtx (rtx *loc, bb_info_t bb_info) else width = GET_MODE_SIZE (GET_MODE (mem)); + if (offset > HOST_WIDE_INT_MAX - width) + { + clear_rhs_from_active_local_stores (); + return; + } + read_info = read_info_type_pool.allocate (); read_info->group_id = group_id; read_info->mem = mem; -- 2.14.3 --------------563F5F42E8942D846BDFCB36--