From patchwork Fri Nov 10 21:45:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 836930 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-466549-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="wLyQU9T8"; dkim-atps=neutral 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 3yYYWR2T9Pz9t38 for ; Sat, 11 Nov 2017 08:46:11 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references; q=dns; s= default; b=JP1tW9zKimSJiXAfjIBYoejqa5R7PB0CiVQ1PXf2hLGRz5Lx5IqRB 4xGVWlDDJP/BpjqY7gxWq2UmyKV6AF0OPeR9lOmC+xmcAKNOgPVs7pHfjnS7uz5I CL6MdZXnMZckbTtZbgkC2Z6q4on2BBv57X4mDPYF6TCiu1eru7M0Pc= 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:from :to:cc:subject:date:message-id:in-reply-to:references; s= default; bh=7wVB4IHrv9xOzcDANrIrEOlE9OA=; b=wLyQU9T8Uitt4TEuzmGz 77o+6+xjMtmphrWu7dpdZS/MIJ7HKQIlZ5Nx/d7c/0Cld5N5PaplEYtoXfsNPkLv uvExNJsI3KBgLNsKI+/4LbFY3/GW58sjFgsTkTRemDlgjUJYcaNc6i0NUZuthAp3 pOrPyzmWci5RC531iWh/yAc= Received: (qmail 11291 invoked by alias); 10 Nov 2017 21:44:01 -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 11249 invoked by uid 89); 10 Nov 2017 21:44:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=71766 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; Fri, 10 Nov 2017 21:44:00 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 32839861C; Fri, 10 Nov 2017 21:43:59 +0000 (UTC) Received: from c64.redhat.com (ovpn-112-13.phx2.redhat.com [10.3.112.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8C28617A8F; Fri, 10 Nov 2017 21:43:57 +0000 (UTC) From: David Malcolm To: Jason Merrill Cc: Nathan Sidwell , Jakub Jelinek , Richard Biener , gcc-patches List , David Malcolm Subject: [PATCH 10/14] warn_for_memset: handle location wrappers Date: Fri, 10 Nov 2017 16:45:25 -0500 Message-Id: <1510350329-48956-11-git-send-email-dmalcolm@redhat.com> In-Reply-To: <1510350329-48956-1-git-send-email-dmalcolm@redhat.com> References: <1510350329-48956-1-git-send-email-dmalcolm@redhat.com> X-IsSubscribed: yes gcc/c-family/ChangeLog: * c-warn.c (warn_for_memset): Strip any location wrappers from arg0 and arg2. gcc/cp/ChangeLog: * parser.c (cp_parser_postfix_expression): Before warn_for_memset, strip any wrapper around "arg2" before testing for CONST_DECL. --- gcc/c-family/c-warn.c | 3 +++ gcc/cp/parser.c | 1 + 2 files changed, 4 insertions(+) diff --git a/gcc/c-family/c-warn.c b/gcc/c-family/c-warn.c index 245c37d..67e6db6 100644 --- a/gcc/c-family/c-warn.c +++ b/gcc/c-family/c-warn.c @@ -1850,6 +1850,9 @@ void warn_for_memset (location_t loc, tree arg0, tree arg2, int literal_zero_mask) { + STRIP_ANY_LOCATION_WRAPPER (arg0); + STRIP_ANY_LOCATION_WRAPPER (arg2); + if (warn_memset_transposed_args && integer_zerop (arg2) && (literal_zero_mask & (1 << 2)) != 0 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 54029ef..aee211f 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -7176,6 +7176,7 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p, tree arg0 = (*args)[0]; tree arg1 = (*args)[1]; tree arg2 = (*args)[2]; + STRIP_ANY_LOCATION_WRAPPER (arg2); int literal_mask = ((!!integer_zerop (arg1) << 1) | (!!integer_zerop (arg2) << 2)); if (TREE_CODE (arg2) == CONST_DECL)