From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 69526 invoked by alias); 20 Dec 2017 00:50:31 -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 69493 invoked by uid 89); 20 Dec 2017 00:50:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= 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; Wed, 20 Dec 2017 00:50:29 +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 D083581DE1; Wed, 20 Dec 2017 00:50:27 +0000 (UTC) Received: from c64.redhat.com (ovpn-112-35.phx2.redhat.com [10.3.112.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3205D60629; Wed, 20 Dec 2017 00:50:25 +0000 (UTC) From: David Malcolm To: Jason Merrill Cc: Nathan Sidwell , Jakub Jelinek , Richard Biener , gcc-patches List , David Malcolm Subject: [v2 of PATCH 15/14] Use fold_for_warn in get_atomic_generic_size Date: Wed, 20 Dec 2017 00:50:00 -0000 Message-Id: <1513731226-38166-1-git-send-email-dmalcolm@redhat.com> In-Reply-To: References: X-IsSubscribed: yes X-SW-Source: 2017-12/txt/msg01331.txt.bz2 On Tue, 2017-12-19 at 15:35 -0500, Jason Merrill wrote: > On Sat, Dec 16, 2017 at 8:12 PM, David Malcolm > wrote: > > I rebased the v2 patchkit; here's an extra patch to fix an issue > > with it uncovered by a recently-added testcase (in r254990). > > > > With the patch kit, but without this patch, g++'s > > c-c++-common/pr83059.c > > fails to emit the "invalid memory model argument 6" warning. > > > > Successfully bootstrapped®rtested on x86_64-pc-linux-gnu, as > > part of the kit. > > > > Is this OK for trunk, assuming the rest of the kit is approved? > > > > gcc/c-family/ChangeLog: > > * c-common.c (get_atomic_generic_size): Call fold_for_warn > > on the > > params before checking for INTEGER_CST. > > --- > > gcc/c-family/c-common.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c > > index 3438b87..ab03b7d 100644 > > --- a/gcc/c-family/c-common.c > > +++ b/gcc/c-family/c-common.c > > @@ -6720,7 +6720,7 @@ get_atomic_generic_size (location_t loc, tree > > function, > > /* Check memory model parameters for validity. */ > > for (x = n_param - n_model ; x < n_param; x++) > > { > > - tree p = (*params)[x]; > > + tree p = fold_for_warn ((*params)[x]); > > if (TREE_CODE (p) == INTEGER_CST) > > { > > /* memmodel_base masks the low 16 bits, thus ignore any > > bits above > > Let's check the error case before we call fold_for_warn. > > Jason Do you mean like this? (bootstrapped; regrtest in progress) Thanks Dave gcc/c-family/ChangeLog: * c-common.c (get_atomic_generic_size): Call fold_for_warn on the params before checking for INTEGER_CST. --- gcc/c-family/c-common.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 3438b87..9d43aaa 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -6721,6 +6721,9 @@ get_atomic_generic_size (location_t loc, tree function, for (x = n_param - n_model ; x < n_param; x++) { tree p = (*params)[x]; + if (p == error_mark_node) + return 0; + p = fold_for_warn (p); if (TREE_CODE (p) == INTEGER_CST) { /* memmodel_base masks the low 16 bits, thus ignore any bits above -- 1.8.5.3