Message ID | 20231019153857.1248815-1-pinskia@gmail.com |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp473379vqb; Thu, 19 Oct 2023 08:38:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHXeSLtiXfaxLchRnGtSbz/ApbAKz5UpOvLPByDzeSFyGk2A5ElGtXgtFRJquuodyGhMfFw X-Received: by 2002:a05:622a:1a16:b0:41c:d11d:4a3b with SMTP id f22-20020a05622a1a1600b0041cd11d4a3bmr848120qtb.49.1697729927476; Thu, 19 Oct 2023 08:38:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697729927; cv=pass; d=google.com; s=arc-20160816; b=itxcEs9vJ4ou0lzAfAnx/juazGq+kRoFCOPvu5mRYQMA5Nz7PGMOwv8XJvLC3k13wS a2kgAOiepwNNzJqR1ESiAWuyosABXY7rroDP2zpFVx64MSnpfM+wLVzGIr9dJTv6dj/b YIZHIAD3ujCazlPndk5Gz6LGZuvY29HwZngTtpztSoJbcgnLc1wa3yj+NM/JWYvi3Drr BsPJMLgf0WXcXk7DbQnbTdacTGAH/+9tzXcxCNCjHWsY7PMYtmtIXXQFKUWgaLRGW/ba kcU0YmfKG8944wmAbtnuTQPg8TMdl8q3n75tEZcoMBbv347o6m0EfGvqJVDobz8bWj9D GUSQ== 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:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=zIihIAX7FcmNSW80C4Q9YNg3N+PmYEeWcYb4xEv88ws=; fh=6xfd3IYC8Zt5CA4TsXZHhPmGMhO9cjo3oiHaQc5bSUI=; b=P5gE2JylGgqXRhsPydnbM1LUkS+zYmVvYzmNZMBju2TBoXNRlwv9lqn6La7XzADxXC 2kxQJx1/XQoxyE1eIC8oIMFCDoluYnXioA1YeDrALAo0xw5NSAzUD7YQrGyxImcYEe/B 0qMTmIgxF35CrqCoUpw9ktX5P33EoLskJkuVKtiU9BYs4BHNIkPALtPG6lMf3VSvdHCo EM9foXbNec6VmwEVVjmMntCv34gVY1ZtC7LD+NSjE2nKAB04YRNfM8xoLGZbe/YNc3K3 jdfu0rOnp1xwHgH5MzeMV44qbp557kGIQnMJKYjVb4iFcI6QcUa/vt4rofAnthcsePUl dO0Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VifDIwVz; 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 z22-20020ac87f96000000b004033ec2f5e4si1740475qtj.464.2023.10.19.08.38.47 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 08:38:47 -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=VifDIwVz; 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 42734385C303 for <ouuuleilei@gmail.com>; Thu, 19 Oct 2023 15:38:47 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by sourceware.org (Postfix) with ESMTPS id 222B93856DD0 for <gcc-patches@gcc.gnu.org>; Thu, 19 Oct 2023 15:38:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 222B93856DD0 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 222B93856DD0 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697729904; cv=none; b=Zv+E+0en24ip4xuQklZTixO/pggi0+5BCgsnrhgv5nTpQRylWuQCKKs4k4w/3WsFwa6gM7/+wRRJxLsNjTNiz0XySx4XtuUMdF6aA+es8azER8QDHFJ8C79mLMNuGIrLphaJbXm5iq7WgC28HlhF7X4wG1IPxCJW7Bj2BtxFqCI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697729904; c=relaxed/simple; bh=i9tKJWRawmAWG8OLR1ZrxdSBXmU/ACJKSCaOrUm6DtM=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=wSVB2PMFyrZxG+3k/aByK6oWxf4pnmreHdJpT5dbRtCzoY06kdIFdlGHv7Wk6gKpxNUqjoYw/ASfq3p+cdGqmqoRd9hDSaPf/JLnSe6YmL1lMyF9crHkL1S9PQpM+/blcfJUQUO+Swj0Q4oiNjNWmDXWMZpvRGAVE8M4CpyMnWw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1c9bca1d96cso57922835ad.3 for <gcc-patches@gcc.gnu.org>; Thu, 19 Oct 2023 08:38:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697729901; x=1698334701; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=zIihIAX7FcmNSW80C4Q9YNg3N+PmYEeWcYb4xEv88ws=; b=VifDIwVzQYfLOy4i8350owROT1+HWStSHEAyCA7oF2b9TylelB/gZvHgvtwhlHC+md 9VwKj5/5+G+0GFNxjDB3D+LSPwDIa0r6ZBv5D5N2DqQHPqV1QFo22KiENQOsCW1yDSBf ssK+LhMN2mnsAc7/w9DCF7p6g2Nbpoy6qesBFCxUOfeifUf4LJ4ioPMMW6IAMoO/CX/e Ho4Ntaqiafw5mo3Qz9XByWcDoOx7dhd3kqcpUeCc2E7OB/c+Hwgjwhlyh+9AaVeULAcb 5jSW4R5RE8b4hHkTDSpJVaOM9slXu2GqkGqI6T6n/lJAuHTj/t7CVqNl/KhXesJxDeyE oATA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697729901; x=1698334701; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zIihIAX7FcmNSW80C4Q9YNg3N+PmYEeWcYb4xEv88ws=; b=Ekj++bpfAPkXrPxNIJm2QVVgrIK9XbwyGUpUTwNzc1GF0MnYIZf7QU9B49SMPjzeF2 QYmE7Bgq10JJLc3LlAxdolPBR5mWBhKoiM3KpDsJOH2WIfGsw4SaTF4ncUhs/qeQNAMU lKPYAoL1naAkgj03ivkFDoIJBENSjQoh1iN9VHuIYG0os4J0pvydfglk6fM8rPte2/yY cSTnByBPYPP0UfFiFmz1dNB7r18YRqTiNErzeVn3MD9uEjE7Adu5KfJf4A6XVZRuW9fM h1aaTF3uAe/E1A2r4XmsBqzMsISKKYD9ZkPSTQv/yi4bpYJwuLibwMWYUbGhYfYCG1GR weEg== X-Gm-Message-State: AOJu0Yy2oaXSNs5ALGreCLIHeC1VkMGCFfrdoiZgvbH97I0uTfUOqjxu D1Tcxxa9nc1UdJXXhqcJfCfBs1QooGVgBg== X-Received: by 2002:a17:902:e54e:b0:1c5:c23c:a9ff with SMTP id n14-20020a170902e54e00b001c5c23ca9ffmr3456156plf.58.1697729900795; Thu, 19 Oct 2023 08:38:20 -0700 (PDT) Received: from xeond.wrightpinski.org ([98.97.114.173]) by smtp.gmail.com with ESMTPSA id e4-20020a17090301c400b001c61e628e98sm2076615plh.175.2023.10.19.08.38.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 08:38:19 -0700 (PDT) From: Andrew Pinski <pinskia@gmail.com> To: gcc-patches@gcc.gnu.org Cc: Andrew Pinski <pinskia@gmail.com> Subject: [PATCH] c: [PR100532] Fix ICE when an agrgument was an error mark Date: Thu, 19 Oct 2023 15:38:57 +0000 Message-Id: <20231019153857.1248815-1-pinskia@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780198856643033571 X-GMAIL-MSGID: 1780198856643033571 |
Series |
c: [PR100532] Fix ICE when an agrgument was an error mark
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Andrew Pinski
Oct. 19, 2023, 3:38 p.m. UTC
In the case of convert_argument, we would return the same expression back rather than error_mark_node after the error message about trying to convert to an incomplete type. This causes issues in the gimplfier trying to see if another conversion is needed. The code here dates back to before the revision history too so it might be the case it never noticed we should return an error_mark_node. Bootstrapped and tested on x86_64-linux-gnu with no regressions. PR c/100532 gcc/c/ChangeLog: * c-typeck.cc (convert_argument): After erroring out about an incomplete type return error_mark_node. gcc/testsuite/ChangeLog: * gcc.dg/pr100532-1.c: New test. --- gcc/c/c-typeck.cc | 2 +- gcc/testsuite/gcc.dg/pr100532-1.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr100532-1.c
Comments
On Thu, Oct 19, 2023 at 03:38:57PM +0000, Andrew Pinski wrote: > In the case of convert_argument, we would return the same expression > back rather than error_mark_node after the error message about > trying to convert to an incomplete type. This causes issues in > the gimplfier trying to see if another conversion is needed. > > The code here dates back to before the revision history too so > it might be the case it never noticed we should return an error_mark_node. > > Bootstrapped and tested on x86_64-linux-gnu with no regressions. Looks OK but please move [PR100532] to the end of the subject. > PR c/100532 > > gcc/c/ChangeLog: > > * c-typeck.cc (convert_argument): After erroring out > about an incomplete type return error_mark_node. > > gcc/testsuite/ChangeLog: > > * gcc.dg/pr100532-1.c: New test. > --- > gcc/c/c-typeck.cc | 2 +- > gcc/testsuite/gcc.dg/pr100532-1.c | 7 +++++++ > 2 files changed, 8 insertions(+), 1 deletion(-) > create mode 100644 gcc/testsuite/gcc.dg/pr100532-1.c > > diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc > index 6e044b4afbc..8f8562936dc 100644 > --- a/gcc/c/c-typeck.cc > +++ b/gcc/c/c-typeck.cc > @@ -3367,7 +3367,7 @@ convert_argument (location_t ploc, tree function, tree fundecl, > { > error_at (ploc, "type of formal parameter %d is incomplete", > parmnum + 1); > - return val; > + return error_mark_node; > } > > /* Optionally warn about conversions that differ from the default > diff --git a/gcc/testsuite/gcc.dg/pr100532-1.c b/gcc/testsuite/gcc.dg/pr100532-1.c > new file mode 100644 > index 00000000000..81e37c60415 > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/pr100532-1.c > @@ -0,0 +1,7 @@ > +/* { dg-do compile } */ > +/* PR c/100532 */ > + > +typedef __SIZE_TYPE__ size_t; > +void *memcpy(void[], const void *, size_t); /* { dg-error "declaration of type name" } */ > +void c(void) { memcpy(c, "a", 2); } /* { dg-error "type of formal parameter" } */ > + Extra newline. Marek
diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc index 6e044b4afbc..8f8562936dc 100644 --- a/gcc/c/c-typeck.cc +++ b/gcc/c/c-typeck.cc @@ -3367,7 +3367,7 @@ convert_argument (location_t ploc, tree function, tree fundecl, { error_at (ploc, "type of formal parameter %d is incomplete", parmnum + 1); - return val; + return error_mark_node; } /* Optionally warn about conversions that differ from the default diff --git a/gcc/testsuite/gcc.dg/pr100532-1.c b/gcc/testsuite/gcc.dg/pr100532-1.c new file mode 100644 index 00000000000..81e37c60415 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr100532-1.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* PR c/100532 */ + +typedef __SIZE_TYPE__ size_t; +void *memcpy(void[], const void *, size_t); /* { dg-error "declaration of type name" } */ +void c(void) { memcpy(c, "a", 2); } /* { dg-error "type of formal parameter" } */ +