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: 152980 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp2724069vqb; Sat, 14 Oct 2023 18:17:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFnS0qhhzjLQaR9LOGIHIBrNxUfaxnqrJI1UnyjiHm09cno5m6aZ/bd3AONTCfGGQM6O+Qd X-Received: by 2002:a05:622a:3cf:b0:412:f12:2398 with SMTP id k15-20020a05622a03cf00b004120f122398mr35809565qtx.31.1697332649620; Sat, 14 Oct 2023 18:17:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697332649; cv=pass; d=google.com; s=arc-20160816; b=XJy9z3kc1VvLEsvYfNJjatxkqbx08GE3RtjItm62+jjWnflOEorUPC6ehZMuh83Rtl jmjOvqIfEagnPiKaZ2N1aP9kIltryKZU2MSxQVO9eLi2LmYL9Kct431OSKtz5DOj02lk EuT5x14pJ0zZA7UWNfLe3/IAQ/wlYN9StTPosecHxGcm85novIkc0KBJVMJcA0QVw3xM qMmzhO5yBg3E2FZ4X7cn9Bail4JlRbBlRcwDII4yq0J1SijHKAUTtms1cpUFW3nz9lcb WIeulOzlCRRYbvnMv7m8q7v26HRCqaAZ7KEO4/o2gMwSglC9Pd5sey9JgdBD+h1ZdCMv 7s6w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:dmarc-filter:arc-filter:delivered-to; bh=MubHR4zI4aBG8InuZKnP/Ptghh00ah9XiaEWBFdw0Tc=; fh=6xfd3IYC8Zt5CA4TsXZHhPmGMhO9cjo3oiHaQc5bSUI=; b=eJRhS3IW/znw+DHvm82ss7ScIrQ/DLNRqkrgemc69l0kJSqnVBuQS6SazlRYuCoD3p g8J2VCFNO/UYCDsPZw5uv8/PRNRGy17jDLV9DJbfkwGskFlamTmlbh68rPw7qhsQDTCc Hia7KBU3Cqd/b9P0t6SOJW+wYaTe8+H5MY518CVHQQbsJOqlLjTDyeKytt9p/wFcwEp2 m942f4fHThcNAzWdcKg4JHZVcuDuM5eMUJlyuDJSp2E6/s+TsnUl6Ol249+jEU1Ivngl hrgGP7yC1mMzngixU54V7M/aRpuYgCW1yaXdMdNSNXh2lbITd03+FsblsU5daHvfOQbt HI3A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=M6uk0y4y; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id h4-20020ac87d44000000b00417f76c4226si3554686qtb.451.2023.10.14.18.17.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Oct 2023 18:17:29 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=M6uk0y4y; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 538A2385800A for ; Sun, 15 Oct 2023 01:17:29 +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-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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779782280492688774 X-GMAIL-MSGID: 1779782280492688774 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" } */