From patchwork Sun Oct 15 01:16:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 1848860 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=M6uk0y4y; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S7MmH39fhz1yqN for ; Sun, 15 Oct 2023 12:17:17 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E994E3858C2C for ; Sun, 15 Oct 2023 01:17:13 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-oo1-xc36.google.com (mail-oo1-xc36.google.com [IPv6:2607:f8b0:4864:20::c36]) by sourceware.org (Postfix) with ESMTPS id B432B3858410 for ; Sun, 15 Oct 2023 01:16:55 +0000 (GMT) ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B432B3858410 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::c36 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697332618; cv=none; b=tRg1WCgQ5VxHWWNIG/nYuZLLsdNJdaIZOHNNKlTNz8W5vcWMxGIx2fz14t2PFd5lDcMrONEjRNZomhBF8UJq7gjI97hP82JKs3hMO5GcsX/jbJ0OGVl+1P0wbg6Sl8cCTv0Mwf8Mla5H+DURex4GQekJAeUlNTovPWcdErH0Vp0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697332618; c=relaxed/simple; bh=9VpFFNvuAJs3wTSDY2JgTWpk40eyQEIzb4i1mFtgV3M=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=ZutfHGXMIhxoLo6b7wLoT2qOLFEfDy/8KHOKjSpgCL2lwAg+4e3GcWvbgnnoOCIEFW0ZduD7y07V7NGQk2hKDbnOVbg3XNkAk0qT+eXid7OUuU7eL72rhMgjvyXJHpzhoM0IFEQgtUx5JgPvdt1uSf5R4jB4F6WZwoW8Iydg1Z0= ARC-Authentication-Results: i=1; server2.sourceware.org DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B432B3858410 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oo1-xc36.google.com with SMTP id 006d021491bc7-57f02eeabcaso2074242eaf.0 for ; Sat, 14 Oct 2023 18:16:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697332614; x=1697937414; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MubHR4zI4aBG8InuZKnP/Ptghh00ah9XiaEWBFdw0Tc=; b=M6uk0y4yDz2sW8Pa9S10dqIL2++oMA+fjqWU1IcKQ/UPTaCzqvWXtwx9CUD2MAvC37 m0YczUcP6cWGxgrJoHobWmt0QSYMyWxR5qoRhs0kpHkWiZlU/ZFkJklExnLbrlLdrwVd RcH4x/Gd7DMyKZYyhMkeL3jYiM5/lvm3AAuDlR9IOk1d2r0TWwWxMZnAqd14HYPrgtj2 235vnwLNTKVaprhEFMqNMvDt1g/qKTJHLJdivM0XNomYM/IJvXOBI4eG45IMQ7WkVQkK l4jinzCtDDzcZhj99dP/WPoUehCeScV58V+j2oZ6U3JfYKX1ZnvgTOlKGFAPUe8Y7ktQ YPhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697332614; x=1697937414; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MubHR4zI4aBG8InuZKnP/Ptghh00ah9XiaEWBFdw0Tc=; b=DQ9YLf65x4fbvvey92dxyq4k+I2eWhq/6aEH9xKSW7LnV4HSOPeHuz4m9zu91q6ZSb JI3maJjd/jDWvvFfv7awv8xF7Q7cSrzI/dQpASA4X11bmwpzQALGLgHAjetJADy8PdtM YVwVPPws2s7amE3Pw3+mqL8LAwOpbNYPv+LEtxbU8ExVY2otBgJTUcInK9AG2XiBJ6W3 Q5XQn84KXW3j3xCMBro1hSINi/rbxY32kUb1QqdAJbcd7QuK/R3I+p3zbV668D7Ocw2C CfnzexqLxuhHdq8dnzrrhAsacGjngBWwDmvCdDgZHNOIGfL+xgSzRHyczmyaAVamgGAy CP0g== X-Gm-Message-State: AOJu0Yz+i2i+aw1brlpyTgkIdVHVwzWBu3lbE9YOvOTwS0HNgJYHMyJx H5ImjLq5eZTocP5UXKE5Mo4JdD7+/KT9LQ== X-Google-Smtp-Source: AGHT+IEYuNYcHlIVrwtI2NmmDiUrUxXKquY1dxlOqeWwIjdHDIypuewNBQcFfjOuVbhlwn51FBzZPQ== X-Received: by 2002:a05:6358:290b:b0:134:ded4:294 with SMTP id y11-20020a056358290b00b00134ded40294mr37513597rwb.17.1697332614042; Sat, 14 Oct 2023 18:16:54 -0700 (PDT) Received: from xeond2.wrightpinski.org ([98.97.114.173]) by smtp.gmail.com with ESMTPSA id w24-20020aa79558000000b006b65b0f903csm2468477pfq.192.2023.10.14.18.16.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Oct 2023 18:16:53 -0700 (PDT) From: Andrew Pinski To: gcc-patches@gcc.gnu.org Cc: Andrew Pinski Subject: [PATCH 2/2] [c] Fix PR 101364: ICE after error due to diagnose_arglist_conflict not checking for error Date: Sat, 14 Oct 2023 18:16:48 -0700 Message-Id: <20231015011648.1608638-2-pinskia@gmail.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231015011648.1608638-1-pinskia@gmail.com> References: <20231015011648.1608638-1-pinskia@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 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 When checking to see if we have a function declaration has a conflict due to promotations, there is no test to see if the type was an error mark and then calls c_type_promotes_to. c_type_promotes_to is not ready for error_mark and causes an ICE. This adds a check for error before the call of c_type_promotes_to. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. PR c/101364 gcc/c/ChangeLog: * c-decl.cc (diagnose_arglist_conflict): Test for error mark before calling of c_type_promotes_to. gcc/testsuite/ChangeLog: * gcc.dg/pr101364-1.c: New test. --- gcc/c/c-decl.cc | 3 ++- gcc/testsuite/gcc.dg/pr101364-1.c | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr101364-1.c diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc index 5822faf01b4..eb2df08c0a7 100644 --- a/gcc/c/c-decl.cc +++ b/gcc/c/c-decl.cc @@ -1899,7 +1899,8 @@ diagnose_arglist_conflict (tree newdecl, tree olddecl, break; } - if (c_type_promotes_to (type) != type) + if (!error_operand_p (type) + && c_type_promotes_to (type) != type) { inform (input_location, "an argument type that has a default " "promotion cannot match an empty parameter name list " diff --git a/gcc/testsuite/gcc.dg/pr101364-1.c b/gcc/testsuite/gcc.dg/pr101364-1.c new file mode 100644 index 00000000000..e7c94a05553 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr101364-1.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c90 "} */ + +void fruit(); /* { dg-message "previous declaration" } */ +void fruit( /* { dg-error "conflicting types for" } */ + int b[x], /* { dg-error "undeclared " } */ + short c) +{} /* { dg-message "an argument type that has a" } */