From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 5F7D9385840F for ; Mon, 25 Apr 2022 15:15:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5F7D9385840F Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-358-zYx6qxb4MaeZmdDKZnQfxw-1; Mon, 25 Apr 2022 11:15:20 -0400 X-MC-Unique: zYx6qxb4MaeZmdDKZnQfxw-1 Received: by mail-qv1-f70.google.com with SMTP id k10-20020ad45bea000000b0044c3ec9f75cso10519616qvc.4 for ; Mon, 25 Apr 2022 08:15:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=4/JluiqdI1gMrnpekNYWUDFfjbz62456oprvBHQNxyA=; b=akzfGLgGrw7fpPUy3Wk+qI1dNqfZJW7CxkiZ9jDAIWwMLa5L6LMXLOBpLKUSmYimS6 gfxoU+wbDnImLqR1xotuNKU+QadcazDXTWUCStPsc2vTbALYddIm7Y+W7+bp6x6uOf8l M3PGOfCt8VMGzjIM9627daxRp2oX7tAcZA4AR94xhxRRPl5QdLzfQNts2g5KnisNJa3C TB44EAP/NBcgERj+P3wMzgBTMvIPbHCdIQxydcceJ5VnyTQR01hQlm+ZH88RNnJssWIc Ps2WeLHIpfEGotFWhbzH5vVQXCLb5FKo5FRnSNu0728lz3cC0XsfzYiVDCq2+TATyHdW cYjQ== X-Gm-Message-State: AOAM531UU9hYAhyxszkSiTA6/2nzqU+i5FLci18gtBfDe7fkAHc3vR94 DeFEK973FZj9zn2jUxi1uETK4eZAzzZl3sXzG9eTirx+KGUHHRfYsBY2Lk2iRETWrjXvltI93xZ krxKdeTbA48MvAZ5oSw== X-Received: by 2002:a05:620a:211a:b0:69e:ce44:d14b with SMTP id l26-20020a05620a211a00b0069ece44d14bmr10282769qkl.268.1650899719698; Mon, 25 Apr 2022 08:15:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRdAgBc4OVgq5Ff95rY80oUaeNiK/SheLifFv4aabG4IieyUah8LTG2mR4a4cbMgwzP3RQEQ== X-Received: by 2002:a05:620a:211a:b0:69e:ce44:d14b with SMTP id l26-20020a05620a211a00b0069ece44d14bmr10282760qkl.268.1650899719394; Mon, 25 Apr 2022 08:15:19 -0700 (PDT) Received: from [192.168.1.100] (130-44-159-43.s15913.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.159.43]) by smtp.gmail.com with ESMTPSA id w10-20020a05620a424a00b00680c0c0312dsm5173703qko.30.2022.04.25.08.15.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 Apr 2022 08:15:18 -0700 (PDT) Message-ID: <1558252e-a4de-a0eb-58ea-a5405a90a33e@redhat.com> Date: Mon, 25 Apr 2022 11:15:17 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH] c++: crash with requires-expr and -Wsequence-point [PR105304] To: Patrick Palka , gcc-patches@gcc.gnu.org References: <20220422183610.3127561-1-ppalka@redhat.com> From: Jason Merrill In-Reply-To: <20220422183610.3127561-1-ppalka@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Apr 2022 15:15:23 -0000 On 4/22/22 14:36, Patrick Palka wrote: > Here we're crashing from verify_sequence_points for this requires-expr > condition because it contains a templated CAST_EXPR with empty operand, > and verify_tree doesn't ignore this empty operand only because the > manual tail recursion that it perform for unary expression trees skips > the NULL test. > > Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for > 10/11/trunk? OK. > PR c++/105304 > > gcc/c-family/ChangeLog: > > * c-common.cc (verify_tree) [restart]: Move up to before the > NULL test. > > gcc/testsuite/ChangeLog: > > * g++.dg/cpp2a/concepts-requires30.C: New test. > --- > gcc/c-family/c-common.cc | 2 +- > gcc/testsuite/g++.dg/cpp2a/concepts-requires30.C | 10 ++++++++++ > 2 files changed, 11 insertions(+), 1 deletion(-) > create mode 100644 gcc/testsuite/g++.dg/cpp2a/concepts-requires30.C > > diff --git a/gcc/c-family/c-common.cc b/gcc/c-family/c-common.cc > index 70f55f3a346..bb0544eeaea 100644 > --- a/gcc/c-family/c-common.cc > +++ b/gcc/c-family/c-common.cc > @@ -2009,12 +2009,12 @@ verify_tree (tree x, struct tlist **pbefore_sp, struct tlist **pno_sp, > enum tree_code code; > enum tree_code_class cl; > > + restart: > /* X may be NULL if it is the operand of an empty statement expression > ({ }). */ > if (x == NULL) > return; > > - restart: > code = TREE_CODE (x); > cl = TREE_CODE_CLASS (code); > > diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-requires30.C b/gcc/testsuite/g++.dg/cpp2a/concepts-requires30.C > new file mode 100644 > index 00000000000..f500af3f616 > --- /dev/null > +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-requires30.C > @@ -0,0 +1,10 @@ > +// PR c++/105304 > +// { dg-do compile { target c++20 } } > +// { dg-additional-options "-Wall -Wsequence-point" } > + > +struct A { }; > + > +int main() { > + if (requires { A(); }) > + ; > +}