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 4C33D385BC23 for ; Wed, 22 Nov 2023 18:40:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4C33D385BC23 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 4C33D385BC23 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700678429; cv=none; b=JrSfufVUf6ZzbR4gRxLjXOwwkiXcvZWd5y3oqKjC6dOcxVUxyCt5+CJusL7QkLRX8TJPR8XiZL32gfHkE7hOq965fNbRjyw9LNkOGCL0rZjBcG936EFfeSR1ztrCwhlY4oQ27kjd5D5lRIZcGZZI1g08NUUjhdGgZ6cYPGMBsys= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700678429; c=relaxed/simple; bh=9TlAYr+Bq0JnIZwY+/TzGualM6IJOm+NMYDomA5OMs8=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=WtZ1npZ81/SohWY+xBs+xzmd9OB1BN2/GoiBOqX/llyTX95oln8NT+nYiYrWPY0FMOqJG4Kd31PuD+sp4hwMIEHLWkND7NsQBMGrYSiQKx53YzA7cfdMSo7JEkMCzS5Zlz4AgdjHbTFT1sDNtP0/64RSGtvpcJyOeWs+Se/pVhE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700678418; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=BULqkTVJraQScoRaGAuNEKIfXN+BCy502oq6pfTU2OQ=; b=eWuyrmU3aSV40JhmBmU9Lp78r1tDvxTdq5KlEOeT9qTcnzKLMSdL5QIlFK96tpvQOacR/j 13fTkXMs/kAAj5EnOkO+u070+p+Ub3fhkGxYAs6VcGflIFt1DtjhoP2MJIQ5QoOwe6+aq4 VFmYo52AYnnHRWjXvKC2ba9DojX+G90= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-76-dJw-IwGQMruOpo9SPQ8kEw-1; Wed, 22 Nov 2023 13:40:17 -0500 X-MC-Unique: dJw-IwGQMruOpo9SPQ8kEw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (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 8D53A101A52D; Wed, 22 Nov 2023 18:40:12 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.194.53]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4B5841121306; Wed, 22 Nov 2023 18:40:12 +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 3AMIe9iE2519165 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 22 Nov 2023 19:40:09 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 3AMIe8l82519164; Wed, 22 Nov 2023 19:40:08 +0100 Date: Wed, 22 Nov 2023 19:40:08 +0100 From: Jakub Jelinek To: Richard Biener , Jason Merrill , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] tree: Fix up try_catch_may_fallthru [PR112619] Message-ID: Reply-To: Jakub Jelinek References: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 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=-3.4 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_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE 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, Nov 22, 2023 at 01:21:12PM +0100, Jakub Jelinek wrote: > So, pedantically perhaps just assuming TRY_CATCH_EXPR where second argument > is not STATEMENT_LIST to be the CATCH_EXPR/EH_FILTER_EXPR case could work > for C++, but there are other FEs and it would be fragile (and weird, given > that STATEMENT_LIST with single stmt in it vs. that stmt ought to be > generally interchangeable). Looking at other FE, e.g. go/go-gcc.cc clearly has: stat_tree = build2_loc(location.gcc_location(), TRY_CATCH_EXPR, void_type_node, stat_tree, build2_loc(location.gcc_location(), CATCH_EXPR, void_type_node, NULL, except_tree)); so CATCH_EXPR is immediately the second operand of TRY_CATCH_EXPR. d/toir.cc has: /* Back-end expects all catches in a TRY_CATCH_EXPR to be enclosed in a statement list, however pop_stmt_list may optimize away the list if there is only a single catch to push. */ if (TREE_CODE (catches) != STATEMENT_LIST) { tree stmt_list = alloc_stmt_list (); append_to_statement_list_force (catches, &stmt_list); catches = stmt_list; } add_stmt (build2 (TRY_CATCH_EXPR, void_type_node, trybody, catches)); so I assume it run into the try_catch_may_fallthru issue (because gimplifier clearly doesn't require that). rust/rust-gcc.cc copies go-gcc.cc and also creates CATCH_EXPR directly in TRY_CATCH_EXPR's operand. Note, the only time one runs into the ICE is when the first operand (i.e. try body) doesn't fall thru, otherwise the function returns true early. Jakub