From patchwork Wed Mar 16 16:20:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Sayle X-Patchwork-Id: 1606249 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nextmovesoftware.com header.i=@nextmovesoftware.com header.a=rsa-sha256 header.s=default header.b=cXd1VuZB; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KJb9S0qDcz9sCD for ; Thu, 17 Mar 2022 03:20:43 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CAAF13865474 for ; Wed, 16 Mar 2022 16:20:40 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from server.nextmovesoftware.com (server.nextmovesoftware.com [162.254.253.69]) by sourceware.org (Postfix) with ESMTPS id DC82C385380D for ; Wed, 16 Mar 2022 16:20:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DC82C385380D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=nextmovesoftware.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nextmovesoftware.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nextmovesoftware.com; s=default; h=Content-Type:MIME-Version:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=jT2D6D3MAcSjgOhrbl4RBblI8OwE/TTcfCsMdcRBXRw=; b=cXd1VuZBTdg94/VRK1GiNJsAqn XvbO9u9kL+4fOkSSKOPiT0U2wP3WqyvqZkJMSBg4YlS+AlaGilPFWrqyT87U5y5/L0vulYdvE7zCS EWt3UoaNZ3q9GqIy9EOKa8BReiwcdkF5GPou30JWF2CnebfpXTj4npMAWL1RUkXQeypKo7IiPf9PD /nSh1QQ9oCDDPLo2K65iJmNl+NLtvY6dEtORWEPB8kJ+83JGkogs8MMMxb+yCcCYp2dURhoJ94oU0 nWkoJ1cGPIFzN/aHCeNAD0REG76G/uEhO5jxA66rlTg5SWLgHz5w1z4vdUWL2uSDrY9FEemhakUZI jUFZbg9g==; Received: from [185.62.158.67] (port=51727 helo=Dell) by server.nextmovesoftware.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nUWNx-0002g3-Ci for gcc-patches@gcc.gnu.org; Wed, 16 Mar 2022 12:20:29 -0400 From: "Roger Sayle" To: "'GCC Patches'" Subject: [C PATCH] PR c/98198: ICE-on-invalid-code error recovery. Date: Wed, 16 Mar 2022 16:20:29 -0000 Message-ID: <003401d83951$c1614060$4423c120$@nextmovesoftware.com> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: Adg5UTUseXp6hPR2RYCzxHNTChtShA== Content-Language: en-gb X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server.nextmovesoftware.com X-AntiAbuse: Original Domain - gcc.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - nextmovesoftware.com X-Get-Message-Sender-Via: server.nextmovesoftware.com: authenticated_id: roger@nextmovesoftware.com X-Authenticated-Sender: server.nextmovesoftware.com: roger@nextmovesoftware.com X-Source: X-Source-Args: X-Source-Dir: X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" This is Christophe Lyon's fix to PR c/98198, an ICE-on-invalid-code regression affecting mainline, and a suitable testcase. Tested on x86_64-pc-linux-gnu with make bootstrap and make -k check with no new failures. Ok for mainline? 2022-03-16 Christophe Lyon Roger Sayle gcc/c-family/ChangeLog PR c/98198 * c-attribs.cc (decl_or_type_attrs): Add error_mark_node check. gcc/testsuite/ChangeLog PR c/98198 * gcc.dg/pr98198.c: New test case. Thanks in advance, Roger diff --git a/gcc/c-family/c-attribs.cc b/gcc/c-family/c-attribs.cc index c885d88..111a33f 100644 --- a/gcc/c-family/c-attribs.cc +++ b/gcc/c-family/c-attribs.cc @@ -806,6 +806,8 @@ decl_or_type_attrs (tree node) return attrs; tree type = TREE_TYPE (node); + if (type == error_mark_node) + return NULL_TREE; return TYPE_ATTRIBUTES (type); } diff --git a/gcc/testsuite/gcc.dg/pr98198.c b/gcc/testsuite/gcc.dg/pr98198.c new file mode 100644 index 0000000..489afae --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr98198.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +static inline void sub_1 ( ) { + struct struct_1 var_9 , var_10 +} + +static int var_9[1] __attribute__ ( ( section ( ".data" ) ) ) ; +/* { dg-excess-errors "" } */