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.129.124]) by sourceware.org (Postfix) with ESMTPS id 2F8B73890035 for ; Wed, 10 Apr 2024 17:24:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2F8B73890035 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2F8B73890035 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712769878; cv=none; b=WG9SunzVzf0GeFAfecijeqnrjFWP+5XxLXUyGMkR/yapn7bC6/MpIEsO5xjxmli3euTywQoljHeRZ48OHZ6WJgFfhfFWdl9Wf3jWxjKGlV/PZVLo9TWUfZNqS+utMp0QfcbjtJfQIBKEZA06s1oYtgBRkL0Jfrh1qnQRYsBsiiE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712769878; c=relaxed/simple; bh=mNJOuf4RRHUOGr11GkWo0Z559VsQAiL568bL+ZFLo7E=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=nAEhmrST8Gh+2VfnBKm2rzdu+H4XxEB5UsDIFWO7cWERqKZLfAesMy22yif9acXU+zyH8B8+IKC8nSosnrIAb/a9bINYpdkaRJdj21hXnzDlYAK1F5jOFDbyOuvqQvf/89shu4ro+BaqukcfKcZvkDhCumOvASb5yajwWWdv1mA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712769867; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=FmhFiD+wnY6IMthYMWxbfFOHYk+zytaH3Pky6/rj5ts=; b=XYlGPmND3XOP4ehPoI3ZtYC3VAn55+AUn+8+5shamXmVcPGmJnZdqLrFOGeNw+Nb3Zwbwo qZeTgo9DUtyBsWYZ72GFtEF/AWgpOJxMG4Btf9wVpWAmm0FG7nI/DZtv1SjOurNRGxdXng RH7x2OXTkGhH/gpTrCoolP6i7EfQnhg= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-161-_VBAigp_MiqNTYnpu7f-3Q-1; Wed, 10 Apr 2024 13:24:25 -0400 X-MC-Unique: _VBAigp_MiqNTYnpu7f-3Q-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 738CF29AA3BA; Wed, 10 Apr 2024 17:24:25 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.45.224.14]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 32CC8C28102; Wed, 10 Apr 2024 17:24:25 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 43AHOJbU113948 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 10 Apr 2024 19:24:19 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 43AHOJWG113947; Wed, 10 Apr 2024 19:24:19 +0200 Date: Wed, 10 Apr 2024 19:24:19 +0200 From: Jakub Jelinek To: Richard Biener Cc: gcc-patches@gcc.gnu.org, jason@redhat.com Subject: Re: [PATCH] c++/114409 - ANNOTATE_EXPR and templates Message-ID: Reply-To: Jakub Jelinek References: <20240410164306.EFDB113942@imap1.dmz-prg2.suse.org> <7o667262-s25q-q265-123s-355r6729p937@fhfr.qr> MIME-Version: 1.0 In-Reply-To: <7o667262-s25q-q265-123s-355r6729p937@fhfr.qr> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, Apr 10, 2024 at 07:10:52PM +0200, Richard Biener wrote: > Ah, I saw the bugzilla patches and wanted this version to be sent > because I think the COMPOUND_EXPR inconsistency is odd. So Jason, > please still have a look, not necessarily because of the bug > which can be fixed in multiple ways but because of that COMPOUND_EXPR > handling oddity (there are already some cases in tsubst_expr that > explicitly recurse with tsubst_stmt). I think if COMPOUND_EXPR appears in a context where only expressions but not statements are allowed (say one of the operands of PLUS_EXPR/MINUS_EXPR/... and hundreds of other places), then the operands of that COMPOUND_EXPR shouldn't be statements either, so we should be using tsubst_expr rather than tsubst_stmt on it for the recursion on the first operand and it should never return NULL. For statements, it can return NULL when the statement is acutally emitted with add_stmt and so nothing more needs to be kept. tsubst_stmt ends with default: gcc_assert (!STATEMENT_CODE_P (TREE_CODE (t))); RETURN (tsubst_expr (t, args, complain, in_decl)); so if something isn't handled by tsubst_stmt, it will handle it using tsubst_expr. But COMPOUND_EXPR is I think intentionally handled by both. ({ ... }) is handled separately in the STMT_EXPR tsubst_expr case, where it calls tsubst_stmt after preparing stuff. Jakub