From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by sourceware.org (Postfix) with ESMTPS id 506EF388B698 for ; Sun, 20 Nov 2022 01:25:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 506EF388B698 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=marvell.com 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 2AJN0svi008214 for ; Sat, 19 Nov 2022 17:25:29 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0220; bh=C2LbcZdsrsQxrn9a8f001tQ2F2oaJjT+q0MIiywSiBA=; b=jIIKXl1oh6PIBqiGCyt44nnI7pYJKLjJSCLqkWKtllKcM7FL2YtVmr/y/FOK5y1m0c/x afk5/z4GEjkosLdVSoX4It2tbOemUzHzyGjCO/KT9noO3PVMPW+AYMPjQuMjaVt7AFUH ync1i0Q2MLZ7EM2NSYpvAcHLOuyBQ2Q8JqFRPMkfZTFUCnDZfiYarTzoyxLgApAnK4rn Y3D+gg3YIQi1uKxc4UNYI0FosBEo1/NofRM0YCJQqtxbNSSbHC8VuOpToSg/FhdbKpAy EttkKPHqanVdi2LsqjoCIvo6Z9f1nbSm6qALyPsi+12kFLYfut6Ubt1ALTVhP3OpsJFe AQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3kxyhrsaeu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Sat, 19 Nov 2022 17:25:29 -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; Sat, 19 Nov 2022 17:25:27 -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; Sat, 19 Nov 2022 17:25:27 -0800 Received: from linux.wrightpinski.org.com (unknown [10.69.242.198]) by maili.marvell.com (Postfix) with ESMTP id 288345B6938; Sat, 19 Nov 2022 17:25:27 -0800 (PST) From: To: CC: Andrew Pinski Subject: [PATCH] Fix PR 106560: Another ICE after conflicting types of redeclaration Date: Sat, 19 Nov 2022 17:25:04 -0800 Message-ID: <1668907504-29652-1-git-send-email-apinski@marvell.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-GUID: vHG-EwhjbAXEPGGLpdBAkSWf-0cPjvDO X-Proofpoint-ORIG-GUID: vHG-EwhjbAXEPGGLpdBAkSWf-0cPjvDO 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-18_08,2022-11-18_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 List-Id: From: Andrew Pinski This another one of these ICE after error issues with the gimplifier and a fallout from r12-3278-g823685221de986af. The problem here is gimplify_modify_expr does not check if either from or to was an error operand. This adds the check and fixes the ICE. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: * gimplify.cc (gimplify_modify_expr): If either *from_p or *to_p were error_operand return early. gcc/testsuite/ChangeLog: * gcc.dg/redecl-23.c: New test. * gcc.dg/redecl-24.c: New test. * gcc.dg/redecl-25.c: New test. --- gcc/gimplify.cc | 3 +++ gcc/testsuite/gcc.dg/redecl-23.c | 6 ++++++ gcc/testsuite/gcc.dg/redecl-24.c | 6 ++++++ gcc/testsuite/gcc.dg/redecl-25.c | 9 +++++++++ 4 files changed, 24 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/redecl-23.c create mode 100644 gcc/testsuite/gcc.dg/redecl-24.c create mode 100644 gcc/testsuite/gcc.dg/redecl-25.c diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc index c62a966e918..02415cb1b5c 100644 --- a/gcc/gimplify.cc +++ b/gcc/gimplify.cc @@ -6054,6 +6054,9 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, location_t loc = EXPR_LOCATION (*expr_p); gimple_stmt_iterator gsi; + if (error_operand_p (*from_p) || error_operand_p (*to_p)) + return GS_ERROR; + gcc_assert (TREE_CODE (*expr_p) == MODIFY_EXPR || TREE_CODE (*expr_p) == INIT_EXPR); diff --git a/gcc/testsuite/gcc.dg/redecl-23.c b/gcc/testsuite/gcc.dg/redecl-23.c new file mode 100644 index 00000000000..425721df2ff --- /dev/null +++ b/gcc/testsuite/gcc.dg/redecl-23.c @@ -0,0 +1,6 @@ +/* We used to ICE in the gimplifier, PR 106560. */ +/* { dg-do compile } */ +/* { dg-options "-w" } */ +void **a; /* { dg-note "" } */ +void b() { void **c = a; } +a; /* { dg-error "" } */ diff --git a/gcc/testsuite/gcc.dg/redecl-24.c b/gcc/testsuite/gcc.dg/redecl-24.c new file mode 100644 index 00000000000..f0f7a723ab8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/redecl-24.c @@ -0,0 +1,6 @@ +/* We used to ICE in the gimplifier, PR 106560 */ +/* { dg-do compile } */ +/* { dg-options "-w" } */ +void **a, **b; /* { dg-note "" } */ +c(){b = a;} +a = /* { dg-error "" } */ diff --git a/gcc/testsuite/gcc.dg/redecl-25.c b/gcc/testsuite/gcc.dg/redecl-25.c new file mode 100644 index 00000000000..4232e19d9a7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/redecl-25.c @@ -0,0 +1,9 @@ +/* We used to ICE in the gimplifier, PR 106560 */ +/* { dg-do compile } */ +/* { dg-options "-w" } */ +void **a; /* { dg-note "" } */ +void b() { + void **c; + c = a /* { dg-error "" } */ +} +a; /* { dg-error "" } */ -- 2.27.0