From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 83591 invoked by alias); 17 Jan 2017 15:26:50 -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 82455 invoked by uid 89); 17 Jan 2017 15:26:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.1 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=damn X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 17 Jan 2017 15:26:48 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B58D681129; Tue, 17 Jan 2017 15:26:48 +0000 (UTC) Received: from localhost.localdomain (ovpn-119-37.rdu2.redhat.com [10.10.119.37]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v0HFQlS9012666; Tue, 17 Jan 2017 10:26:48 -0500 Subject: Re: [PATCH] avoid calling memset et al. with excessively large sizes (PR 79095) To: Martin Sebor , Gcc Patch List References: <497e7848-5690-2c4e-7277-cab674a60a35@gmail.com> From: Jeff Law Message-ID: Date: Tue, 17 Jan 2017 15:26:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <497e7848-5690-2c4e-7277-cab674a60a35@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2017-01/txt/msg01221.txt.bz2 On 01/16/2017 05:06 PM, Martin Sebor wrote: > The test case submitted in bug 79095 - [7 regression] spurious > stringop-overflow warning shows that GCC optimizes some loops > into calls to memset with size arguments in excess of the object > size limit. Since such calls will unavoidably lead to a buffer > overflow and memory corruption the attached patch detects them > and replaces them with a trap. That both prevents the buffer > overflow and eliminates the warning. But doesn't the creation of the bogus memset signal an invalid transformation in the loop optimizer? ie, if we're going to convert a loop into a memset, then we'd damn well better be sure the loop bounds are reasonable. Jeff