From patchwork Tue May 2 10:17:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 757527 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 3wHHMB3HSgz9s0g for ; Tue, 2 May 2017 20:19:01 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="VUY64pgp"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=PxZQ+qqNIquPXfajM RbVNMHJJINoLCNNQCi+ABsPN7GVoho5/KQjQLLulh94t7mntYlcvdQBjCotAvKdM UWk8hZ/kzUxcrHGsauumuGYqna3ccbljWbV50PB3oeglgHB9IwXrSDfD3mmhAfGA y+APSVwWo363XlfRxWqelh4t2w= 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 :subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=x3LJDt10cfdKltLVIhnUr2a cxKg=; b=VUY64pgp7IaKBfzEjfqvXgOc542yCr2FMJ19iuRPXfPxe1RTLtY9Asy nKOrRp2AtF0rzRexAzyyIlhnBngXUuK2dJhxSag4vPOIBwDBRaa7jFUE8mzBV7hR aaL6OpE53izNcYdXoA2X2aaV6y5FUhlDciRn7cacWDebHM7UBlfc= Received: (qmail 122691 invoked by alias); 2 May 2017 10:17:53 -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 122605 invoked by uid 89); 2 May 2017 10:17:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy= X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 02 May 2017 10:17:49 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-MBX-04.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1d5UsO-000606-HF from Tom_deVries@mentor.com ; Tue, 02 May 2017 03:17:48 -0700 Received: from [127.0.0.1] (137.202.0.87) by SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Tue, 2 May 2017 11:17:44 +0100 Subject: Re: [PATCH] adding missing LTO to some warning options (PR 78606) To: Martin Sebor , Gcc Patch List , Richard Biener References: <06c24069-90af-5778-52a2-c9167eb109ab@gmail.com> <568de1cb-21ed-26ea-8a80-f177f189f293@mentor.com> <8b597659-d03e-840d-271e-65fa77415090@gmail.com> From: Tom de Vries Message-ID: <8cf050be-ad29-8f41-8120-bd1ff568b67c@mentor.com> Date: Tue, 2 May 2017 12:17:40 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <8b597659-d03e-840d-271e-65fa77415090@gmail.com> X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) On 05/01/2017 08:05 PM, Martin Sebor wrote: > On 04/30/2017 02:02 PM, Tom de Vries wrote: >> On 01/10/2017 11:16 PM, Martin Sebor wrote: >>> + __builtin_sprintf (d, "%32s", "x"); /* { dg-warning "directive >>> writing 32 bytes into a region of size 12" "-Wformat-length" { xfail >>> *-*-* } } */ >> >> This xpasses for me on an older system: >> ... >> XPASS: gcc.dg/pr78768.c -Wformat-overflow (test for warnings, line 11) >> ... >> >> The mechanism is as follows: >> - the system doesn't have linker plugin support, and sets >> HAVE_LTO_PLUGIN to 0 >> - consequently, opts.c:finish_options() sets x_flag_fat_lto_objects to 1 >> in cc1 >> - cgraphunit.c:symbol_table::compile() does not return >> here: >> ... >> /* Do nothing else if any IPA pass found errors or if we are just >> streaming LTO. */ >> if (seen_error () >> || (!in_lto_p && flag_lto && !flag_fat_lto_objects)) >> { >> timevar_pop (TV_CGRAPHOPT); >> return; >> } >> ... >> and ends up calling expand_all_functions, which calls >> pass_sprintf_length >> - the warning is generated by cc1 >> >> Maybe the test needs: >> ... >> /* { dg-require-linker-plugin "" } */ >> ... >> ? > > That seems possible. IIUC, without linker plugin support the > pass will run when the ordinary object file is created during > the first stage of compilation. I don't have a system to confirm > it on but if pr78768.c xfails when you add the directive I'd say > go ahead and commit the fix as obvious. Done. Thanks, - Tom Require linker plugin for pr78768.c The test-case has an xfail-ed line. For linkers without plugin support, that line happens to xpass. Require linker with plugin support, such that the line is no longer xpass-ing, but unsupported. 2017-05-01 Tom de Vries * gcc.dg/pr78768.c: Require linker plugin. --- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.dg/pr78768.c | 1 + 2 files changed, 5 insertions(+) diff --git a/gcc/testsuite/gcc.dg/pr78768.c b/gcc/testsuite/gcc.dg/pr78768.c index 68d717a..b6cda47 100644 --- a/gcc/testsuite/gcc.dg/pr78768.c +++ b/gcc/testsuite/gcc.dg/pr78768.c @@ -2,6 +2,7 @@ by -flto { dg-do link } { dg-require-effective-target lto } + { dg-require-linker-plugin "" } { dg-options "-O2 -Walloca-larger-than=10 -Wformat -Wformat-overflow -flto" } */ int main (void)