From patchwork Fri Nov 18 03:25:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Pan2 via Gcc-patches" X-Patchwork-Id: 22085 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp754950wrr; Thu, 17 Nov 2022 19:26:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf5iET/1AgxdvxunTGe7T/nR662U++ZtdgzPU33MOgU981+adDH3h4cYBmzhqvNtGwXy8KW/ X-Received: by 2002:a17:906:1354:b0:78d:36d7:ed29 with SMTP id x20-20020a170906135400b0078d36d7ed29mr4487151ejb.655.1668741976106; Thu, 17 Nov 2022 19:26:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668741976; cv=none; d=google.com; s=arc-20160816; b=ejcubSaSpD+00yraGQn5uNOQuUJTYamEJAXuyc4lut5C1s8CE2SnrHxd4paJcSIEJu /hpK7plxy2LcBZbEbzSv52aWLkLUogRAdBlngqhWhLQmkfgUM5s/XurD8j/Q+beYiWAp prJnktSns6YzZFYKgNZgcizra3BsNwMt6oniwQP7TKKRUugwcx2n3+PFyp6y8sjh5f/e mhEoD4rpz8mPXFmtWB5dwI8vUc8xqvPBMHgywpqXp7jvvpxjWLN4nbQz9C2DyhV2y5A1 378YW/R2uurf8bBKchUNy9xEOM9Q6XAqB80vDe1Aq2lH3Twc9PgEsYEbm7jZJ9iJDpvx NNKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:mime-version :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=Wz9SqNqwNM7b5Qqd5df82GiP7w6Mcm4/I0YfEx4s6+E=; b=nAwi0K3GakZ9rOWzOjJhYTRKDN+0vdbw2MuXrT/TFS+dF5f70i5CT+Zy7zqz4qt7/J OmZhteLfTdKLeUqQBY2u/DBQeCUOwTHodIRwqIxzXuvhwiI70gU3DoW8k+6dJRnKke1G tNtvvQQWIYA0qOoH/GbM/6QIPM41zjkKL5RR+62Tccy27V+q3TjuyAC+ZgY9Iogfcnn2 iz7bqqGTQdPJI5PjzYYsLFA8kC6KruWaGo4enkbKkLAGMr99gyXeTIBlb0GN+Ki4tY+1 Qz6pdmLNTClkZxxsrll+HhaZ2E8OBG08onr2xGbOUFiEiqFuO/kP/VY9cw1gkDAlddzo QU+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=KDMedrUS; 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=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id b7-20020a056402084700b004690009024csi1445951edz.503.2022.11.17.19.26.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 19:26:16 -0800 (PST) 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=@gcc.gnu.org header.s=default header.b=KDMedrUS; 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=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 72FA03852200 for ; Fri, 18 Nov 2022 03:26:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 72FA03852200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668741969; bh=Wz9SqNqwNM7b5Qqd5df82GiP7w6Mcm4/I0YfEx4s6+E=; h=To:CC:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=KDMedrUSdFr0SPBxTIrbq+PNZk5Yyauzxghvw+I0clhz0o+a6QXUdATnScq1igEyQ rPflgI/WsVRYBvoeiik4r7HoqpmOKnj+ruTDAekjRHizmiHiqtW9yUe74EEl0+8+RP 0vSsGDVDfQFt9IRdZ2XSVNZKFQRhDiSfS1ka2yys= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by sourceware.org (Postfix) with ESMTPS id B8C483853D68 for ; Fri, 18 Nov 2022 03:25:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B8C483853D68 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AI1x39t004813 for ; Thu, 17 Nov 2022 19:25:22 -0800 Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3kx0ut8ayj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 17 Nov 2022 19:25:22 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 17 Nov 2022 19:25:20 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 17 Nov 2022 19:25:20 -0800 Received: from linux.wrightpinski.org.com (unknown [10.69.242.198]) by maili.marvell.com (Postfix) with ESMTP id A21F63F7083; Thu, 17 Nov 2022 19:25:17 -0800 (PST) To: CC: Andrew Pinski Subject: [PATCH 1/2] Fix PRs 106764, 106765, and 107307, all ICE after invalid re-declaration Date: Thu, 17 Nov 2022 19:25:10 -0800 Message-ID: <1668741911-1727-1-git-send-email-apinski@marvell.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Proofpoint-GUID: FQ-pnyx15rAN6Jd_JNZG1oVDhdFKl5Nr X-Proofpoint-ORIG-GUID: FQ-pnyx15rAN6Jd_JNZG1oVDhdFKl5Nr X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-17_06,2022-11-17_01,2022-06-22_01 X-Spam-Status: No, score=-14.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: apinski--- via Gcc-patches From: "Li, Pan2 via Gcc-patches" Reply-To: apinski@marvell.com Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749802786634786875?= X-GMAIL-MSGID: =?utf-8?q?1749802786634786875?= From: Andrew Pinski The problem here is the gimplifier returns GS_ERROR but in some cases we don't check that soon enough and try to do other work which could crash. So the fix in these two cases is to return GS_ERROR early if the gimplify_* functions had return GS_ERROR. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. Thanks, Andrew Pinski gcc/ChangeLog: PR c/106764 PR c/106765 PR c/107307 * gimplify.cc (gimplify_compound_lval): Return GS_ERROR if gimplify_expr had return GS_ERROR. (gimplify_call_expr): Likewise. gcc/testsuite/ChangeLog: PR c/106764 PR c/106765 PR c/107307 * gcc.dg/redecl-19.c: New test. * gcc.dg/redecl-20.c: New test. * gcc.dg/redecl-21.c: New test. --- gcc/gimplify.cc | 5 +++++ gcc/testsuite/gcc.dg/redecl-19.c | 5 +++++ gcc/testsuite/gcc.dg/redecl-20.c | 9 +++++++++ gcc/testsuite/gcc.dg/redecl-21.c | 9 +++++++++ 4 files changed, 28 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/redecl-19.c create mode 100644 gcc/testsuite/gcc.dg/redecl-20.c create mode 100644 gcc/testsuite/gcc.dg/redecl-21.c diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc index f06ce3cc77a..c62a966e918 100644 --- a/gcc/gimplify.cc +++ b/gcc/gimplify.cc @@ -3272,6 +3272,8 @@ gimplify_compound_lval (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, tret = gimplify_expr (p, pre_p, post_p, is_gimple_min_lval, fallback | fb_lvalue); ret = MIN (ret, tret); + if (ret == GS_ERROR) + return GS_ERROR; /* Step 2a: if we have component references we do not support on registers then make sure the base isn't a register. Of course @@ -3709,6 +3711,9 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value) ret = gimplify_expr (&CALL_EXPR_FN (*expr_p), pre_p, NULL, is_gimple_call_addr, fb_rvalue); + if (ret == GS_ERROR) + return GS_ERROR; + nargs = call_expr_nargs (*expr_p); /* Get argument types for verification. */ diff --git a/gcc/testsuite/gcc.dg/redecl-19.c b/gcc/testsuite/gcc.dg/redecl-19.c new file mode 100644 index 00000000000..cc10685448b --- /dev/null +++ b/gcc/testsuite/gcc.dg/redecl-19.c @@ -0,0 +1,5 @@ +/* We used to ICE in the gimplifier, PR 106764 */ +/* { dg-do compile } */ +/* { dg-options "-w" } */ +(*a)(); // { dg-note "" } +b(){a()} a; // { dg-error "" } diff --git a/gcc/testsuite/gcc.dg/redecl-20.c b/gcc/testsuite/gcc.dg/redecl-20.c new file mode 100644 index 00000000000..07f52115ec8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/redecl-20.c @@ -0,0 +1,9 @@ +/* We used to ICE in the gimplifier, PR 107307 */ +// { dg-do compile } +// { dg-options "-w" } +void f () +{ + const struct { int a[1]; } b; // { dg-note "" } + int *c = b.a; + int *b; // { dg-error "" } +} diff --git a/gcc/testsuite/gcc.dg/redecl-21.c b/gcc/testsuite/gcc.dg/redecl-21.c new file mode 100644 index 00000000000..2f2a6548a57 --- /dev/null +++ b/gcc/testsuite/gcc.dg/redecl-21.c @@ -0,0 +1,9 @@ +/* We used to ICE in the gimplifier, PR 106765 */ +/* { dg-do compile } */ +/* { dg-options "-w" } */ +struct a { + int b +} c() { + struct a a; // { dg-note "" } + a.b; + d a; // { dg-error "" } From patchwork Fri Nov 18 03:25:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Pan2 via Gcc-patches" X-Patchwork-Id: 22084 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp754943wrr; Thu, 17 Nov 2022 19:26:15 -0800 (PST) X-Google-Smtp-Source: AA0mqf4KextPZyVhk3AQri6Whau6VNxvLoLI94JHZAJqdcPCuGZySoeg9Ibz4fwwlzouibeCNiM6 X-Received: by 2002:a17:906:130b:b0:7ad:92c5:637a with SMTP id w11-20020a170906130b00b007ad92c5637amr4439278ejb.87.1668741975643; Thu, 17 Nov 2022 19:26:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668741975; cv=none; d=google.com; s=arc-20160816; b=BkbVHe5mTNVp+N4nlSglzD+ERigIMdIjzUZvomihdW4e1vbzbxgKPQVIXOCEC2GMOH m818LwzzTsjxRR+0Ohp9DUYmWgvbw13pz0v8wbCcL9EqngFfhfap9Q9oyY+21mwjZ8RB CQ6HUdZ6DRhIlPTa88NG7mCUxO4HDiGlPQarZBbtZlxOz4FTP/pn6lsomjCLOwpXTmO+ d54RPcPfHc4X0UYo+ypdEraTX8pLq0VMwTQjz3dQ7WAnyH+ySV7aCEqZbT9AAhIu5sE7 yjavGtRmNBO6ZWd0hgQ3Nc5PlRCkxQWQnRUKtF9BDM+9nidAxalrwQlc0llk8QuOPAu+ 15Eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:mime-version :references:in-reply-to:message-id:date:subject:cc:to:dmarc-filter :delivered-to:dkim-signature:dkim-filter; bh=Dx3dxL1zMj0YOJdWCudEtQGTN3hAEvb9cXhIGVC7VVo=; b=QkbCA626RrQoM35j0JSf8Mrbxve8zG8u/MYvvx+aYb4Smx+m+/aRfDipjSBH7GaG1V dXO+vRhsPqtgaWi//GH+ReP5O4Nib7iDDIhvDS7nWyUyAxoerN+eWfts0uXQW55Ed44P r67A+nFdG4EcmyMbv6vkKDnoWgzXDiq9Gcii+YYNbbds25zyI90M+YJGhGv4VwzGFhSZ ScKuHUoHZOPmBmGHWQWtiOkis5TZ71x34P+vu8OcKbSPRI4sDBf1E0gTXtYZQWfywPUk iKtnEjY1fQlHjcz58Lc4JUjzCXvJp1mOTbaoAH6IgtZBAzpD/PQBWftLjSPSG4O3u4PK 3Rdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="d/a85a4N"; 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=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id qw16-20020a1709066a1000b0078232bfe3a0si2350523ejc.331.2022.11.17.19.26.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 19:26:15 -0800 (PST) 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=@gcc.gnu.org header.s=default header.b="d/a85a4N"; 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=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 08FFA384F497 for ; Fri, 18 Nov 2022 03:26:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 08FFA384F497 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668741969; bh=Dx3dxL1zMj0YOJdWCudEtQGTN3hAEvb9cXhIGVC7VVo=; h=To:CC:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=d/a85a4N01FYtgIUdDJdR41yk+lWeH4v4iYrwWLHBS2ED6L6fZabiC8VGSh+A/PhZ KVobF3/RCcJ/Qu6PPo9FcnhveRQ8W2HMZQ0CQ8W6/bkOxLyqb09H7VdE4M9UtjTJpI a3qmDdxdVNVgNlNjZg05qLCufNt81IQS+xZGjzNs= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by sourceware.org (Postfix) with ESMTPS id B8995385841C for ; Fri, 18 Nov 2022 03:25:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B8995385841C Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AI1wNd3003432 for ; Thu, 17 Nov 2022 19:25:22 -0800 Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3kx0ut8ayk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 17 Nov 2022 19:25:22 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 17 Nov 2022 19:25:20 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 17 Nov 2022 19:25:20 -0800 Received: from linux.wrightpinski.org.com (unknown [10.69.242.198]) by maili.marvell.com (Postfix) with ESMTP id 139C43F704E; Thu, 17 Nov 2022 19:25:18 -0800 (PST) To: CC: Andrew Pinski Subject: [PATCH 2/2] Fix PR middle-end/107705: ICE after reclaration error Date: Thu, 17 Nov 2022 19:25:11 -0800 Message-ID: <1668741911-1727-2-git-send-email-apinski@marvell.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1668741911-1727-1-git-send-email-apinski@marvell.com> References: <1668741911-1727-1-git-send-email-apinski@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: K4iVMwmIjg7TUgzK6bbhVzcwQGUIjhHQ X-Proofpoint-ORIG-GUID: K4iVMwmIjg7TUgzK6bbhVzcwQGUIjhHQ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-17_06,2022-11-17_01,2022-06-22_01 X-Spam-Status: No, score=-14.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: apinski--- via Gcc-patches From: "Li, Pan2 via Gcc-patches" Reply-To: apinski@marvell.com Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749802786086832386?= X-GMAIL-MSGID: =?utf-8?q?1749802786086832386?= From: Andrew Pinski The problem here is after we created a call expression in the C front-end, we replace the decl type with an error mark node. We then end up calling aggregate_value_p with the call expression with the decl with the error mark as the type and we ICE. The fix is to check the function type after we process the call expression inside aggregate_value_p to get it. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. Thanks, Andrew Pinski gcc/ChangeLog: PR middle-end/107705 * function.cc (aggregate_value_p): Return 0 if the function type was an error operand. gcc/testsuite/ChangeLog: * gcc.dg/redecl-22.c: New test. --- gcc/function.cc | 3 +++ gcc/testsuite/gcc.dg/redecl-22.c | 9 +++++++++ 2 files changed, 12 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/redecl-22.c diff --git a/gcc/function.cc b/gcc/function.cc index 361aa5f7ed1..9c8773bbc59 100644 --- a/gcc/function.cc +++ b/gcc/function.cc @@ -2090,6 +2090,9 @@ aggregate_value_p (const_tree exp, const_tree fntype) if (VOID_TYPE_P (type)) return 0; + if (error_operand_p (fntype)) + return 0; + /* If a record should be passed the same as its first (and only) member don't pass it as an aggregate. */ if (TREE_CODE (type) == RECORD_TYPE && TYPE_TRANSPARENT_AGGR (type)) diff --git a/gcc/testsuite/gcc.dg/redecl-22.c b/gcc/testsuite/gcc.dg/redecl-22.c new file mode 100644 index 00000000000..7758570fabe --- /dev/null +++ b/gcc/testsuite/gcc.dg/redecl-22.c @@ -0,0 +1,9 @@ +/* We used to ICE in the gimplifier, PR 107705 */ +/* { dg-do compile } */ +/* { dg-options "-w" } */ +int f (void) +{ + int (*p) (void) = 0; // { dg-note "" } + return p (); + int p = 1; // { dg-error "" } +}