From patchwork Tue Feb 23 07:55:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Wielaard X-Patchwork-Id: 586746 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 B74F11402B4 for ; Tue, 23 Feb 2016 18:55:56 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=s/x53vft; 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 :message-id:subject:from:to:cc:date:in-reply-to:references :content-type:content-transfer-encoding:mime-version; q=dns; s= default; b=Q+idOHsLhF4dPCbZMhxJicQIQL0hyD8vBOaVoSSO1/s6WjIkIwZl8 rC52UI0vB3ZyDm/yVyv5LvYaAxATtsv5uoJWh0C7cB4e+lK4Mvur6ZMNqbzG/w+l vcWW2GbRNtIXzNQBSpi1MyQb3g1GTrM2oqr7PjEroZRV5b9HNZuzB4= 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 :message-id:subject:from:to:cc:date:in-reply-to:references :content-type:content-transfer-encoding:mime-version; s=default; bh=NBKUoyT6L3/Oxy+So2WE+iCiVy4=; b=s/x53vftOSX3+LoJnAP4YAlD6ZaS GdGWVHAQxpqHonYxZ66DhHQt2L/EPm0+2T6CiZGK2UaxiZAS7RX0DenedBBVzMu7 P4LKsVyYf2hFatJ/YK+P7fBjCE91yUIZb+5K8siJ/iLTA/pZt0lT3y5xRlAqU2qd 8mumx4Vu/0iaH9s= Received: (qmail 101384 invoked by alias); 23 Feb 2016 07:55:48 -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 101361 invoked by uid 89); 23 Feb 2016 07:55:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=9448, H*M:101, H*MI:sk:5603E4D, Hx-languages-length:1423 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 23 Feb 2016 07:55:46 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 59D32341452; Tue, 23 Feb 2016 07:55:45 +0000 (UTC) Received: from bordewijk.wildebeest.org (ovpn-113-216.phx2.redhat.com [10.3.113.216]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1N7thwr018330 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 23 Feb 2016 02:55:44 -0500 Received: by bordewijk.wildebeest.org (Postfix, from userid 1000) id D452D8148038; Tue, 23 Feb 2016 08:55:42 +0100 (CET) Message-ID: <1456214140.7770.101.camel@redhat.com> Subject: Re: [PATCH] PR28901 Add two levels for -Wunused-const-variable. From: Mark Wielaard To: "H.J. Lu" Cc: Jeff Law , GCC Patches , Bernd Schmidt , Martin Sebor , Steve Ellcey , Jakub Jelinek , Manuel =?ISO-8859-1?Q?L=F3pez-Ib=E1=F1ez?= Date: Tue, 23 Feb 2016 08:55:40 +0100 In-Reply-To: References: <5603E4D3.4050806@redhat.com> <1456018952-25270-1-git-send-email-mjw@redhat.com> <56CB5A34.8030301@redhat.com> <20160222224312.GK2586@blokker.redhat.com> Mime-Version: 1.0 On Mon, 2016-02-22 at 19:20 -0800, H.J. Lu wrote: > It caused: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69911 Apologies. Apparently main_input_filename can be NULL. I am not entirely sure when that happens. Or how I failed to see that test failure. I think I didn't have java enabled, causing libffi to be skipped. I am testing this patch that skips the test in that case: diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 49f6c25..788f07e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-02-23 Mark Wielaard + + PR c/69911 + * cgraphunit.c (check_global_declaration): Check main_input_filename + is not NULL. + 2016-02-20 Mark Wielaard PR c/28901 diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 27a073a..6c14be2 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -944,8 +944,9 @@ check_global_declaration (symtab_node *snode) || (((warn_unused_variable && ! TREE_READONLY (decl)) || (warn_unused_const_variable > 0 && TREE_READONLY (decl) && (warn_unused_const_variable == 2 - || filename_cmp (main_input_filename, - DECL_SOURCE_FILE (decl)) == 0))) + || (main_input_filename != NULL + && filename_cmp (main_input_filename, + DECL_SOURCE_FILE (decl)) == 0)))) && TREE_CODE (decl) == VAR_DECL)) && ! DECL_IN_SYSTEM_HEADER (decl) && ! snode->referred_to_p (/*include_self=*/false)