From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by sourceware.org (Postfix) with ESMTPS id 9C32D3858D28 for ; Fri, 22 Mar 2024 04:19:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9C32D3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=quicinc.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9C32D3858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711081174; cv=none; b=FwJ3pgjptGqoXN8OHFzDslO/8PsPtH97OzoPr9W7v4as3EgLoRyiZKfb3hz11nndYMPtLUHbHQzvMva0cE23lWD5sA/2LS8tHXgCV67LEj815WESUaoJ593EYaytfvTW50kG2x2/DMfOeZ59rTfgQbNWyMRpSSKY/tKt3Btck7A= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711081174; c=relaxed/simple; bh=rqUOAcmQkV/fdYlR0QwHVvXX9lOmffUwn1oQ5txkBlI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=kDYMIn/6Z55kp4cNY0dt/8VHcWbLCEOLhDgkI1Osva7GDQqusBk01frSDAzwDTewjm2EaisCrac6i/Rb/C1c4+u3RDG/NpyshfUlHLVRfn7jjWtdayggANBU96rtQWSVR9ENYnJH2OzzHiuLjXquRG/dnMB0SPr4QJn+/LViRpw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42M3diKR011525 for ; Fri, 22 Mar 2024 04:19:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=qcppdkim1; bh=rhYrKQ0 GNEmlbu4JwZf6aV0KF0SNigTHdK3cwb0wiQQ=; b=HKovw6Aq1oth0LFGIWf5oxs 3+VSzTTb6AVzCQlZpxYu1enqskAKOGJ7UiaKMIEyaB54sZloNuGE7MX88ieR3kB8 RNkC8NNvR9Ae4NmixDee80t3NqX0RfvymcDeY4KK9HjWP7Q5oZluGK3jMTjEv3FY gdLKfzvFONyHmyUwBjuSDHNvDspbeoNnESUwvq3Id0eqXw6JTqLAJbiWyQ0XvlrU SAMmQI2qhalic3ZQgfLvotS7BkxWAG5Hkz+mY/8+P4OAwFYCgK1zpJpDWzzb63W+ P7gMBB//ch7HawOS1cCT7LU2TyfwteIXxPgZb81MnW99aHWLAyiybJXiBxDBQxA= = Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3x0wy4gn73-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 22 Mar 2024 04:19:31 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 42M4JU2i027044 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 22 Mar 2024 04:19:30 GMT Received: from hu-apinski-lv.qualcomm.com (10.49.16.6) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Thu, 21 Mar 2024 21:19:30 -0700 From: Andrew Pinski To: CC: Andrew Pinski Subject: [PATCH] Another ICE after conflicting types of redeclaration [PR109619] Date: Thu, 21 Mar 2024 21:19:02 -0700 Message-ID: <20240322041902.1135674-1-quic_apinski@quicinc.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01b.na.qualcomm.com (10.47.209.197) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: D5duQSMXRPmUEtSinIoM-p_v5XGi9U4L X-Proofpoint-GUID: D5duQSMXRPmUEtSinIoM-p_v5XGi9U4L X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-21_14,2024-03-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 mlxlogscore=999 mlxscore=0 suspectscore=0 malwarescore=0 adultscore=0 phishscore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 impostorscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2403210001 definitions=main-2403220029 X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,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 List-Id: This another one of these ICE after error issues with the gimplifier and a fallout from r12-3278-g823685221de986af. This case happens when we are trying to fold memcpy/memmove. There is already code to try to catch ERROR_MARKs as arguments to the builtins so just need to change them to use error_operand_p which checks the type of the expression to see if it was an error mark also. Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: PR c/109619 * builtins.cc (fold_builtin_1): Use error_operand_p instead of checking against ERROR_MARK. (fold_builtin_2): Likewise. (fold_builtin_3): Likewise. gcc/testsuite/ChangeLog: PR c/109619 * gcc.dg/redecl-26.c: New test. Signed-off-by: Andrew Pinski --- gcc/builtins.cc | 12 ++++++------ gcc/testsuite/gcc.dg/redecl-26.c | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/redecl-26.c diff --git a/gcc/builtins.cc b/gcc/builtins.cc index eda8bea9c4b..bb74b5cbcd6 100644 --- a/gcc/builtins.cc +++ b/gcc/builtins.cc @@ -10461,7 +10461,7 @@ fold_builtin_1 (location_t loc, tree expr, tree fndecl, tree arg0) tree type = TREE_TYPE (TREE_TYPE (fndecl)); enum built_in_function fcode = DECL_FUNCTION_CODE (fndecl); - if (TREE_CODE (arg0) == ERROR_MARK) + if (error_operand_p (arg0)) return NULL_TREE; if (tree ret = fold_const_call (as_combined_fn (fcode), type, arg0)) @@ -10601,8 +10601,8 @@ fold_builtin_2 (location_t loc, tree expr, tree fndecl, tree arg0, tree arg1) tree type = TREE_TYPE (TREE_TYPE (fndecl)); enum built_in_function fcode = DECL_FUNCTION_CODE (fndecl); - if (TREE_CODE (arg0) == ERROR_MARK - || TREE_CODE (arg1) == ERROR_MARK) + if (error_operand_p (arg0) + || error_operand_p (arg1)) return NULL_TREE; if (tree ret = fold_const_call (as_combined_fn (fcode), type, arg0, arg1)) @@ -10693,9 +10693,9 @@ fold_builtin_3 (location_t loc, tree fndecl, tree type = TREE_TYPE (TREE_TYPE (fndecl)); enum built_in_function fcode = DECL_FUNCTION_CODE (fndecl); - if (TREE_CODE (arg0) == ERROR_MARK - || TREE_CODE (arg1) == ERROR_MARK - || TREE_CODE (arg2) == ERROR_MARK) + if (error_operand_p (arg0) + || error_operand_p (arg1) + || error_operand_p (arg2)) return NULL_TREE; if (tree ret = fold_const_call (as_combined_fn (fcode), type, diff --git a/gcc/testsuite/gcc.dg/redecl-26.c b/gcc/testsuite/gcc.dg/redecl-26.c new file mode 100644 index 00000000000..5f8889c4c39 --- /dev/null +++ b/gcc/testsuite/gcc.dg/redecl-26.c @@ -0,0 +1,14 @@ +/* We used to ICE while folding memcpy and memmove. + PR c/109619. */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +int *a1, *a2; + +void foo(__SIZE_TYPE__ a3) /* { dg-note "" } */ +{ + __builtin_memcpy(a1, a2, a3); + __builtin_memmove(a1, a2, a3); + int *a3; /* { dg-error "redeclared as different kind of symbol" } */ +} + -- 2.43.0