From patchwork Tue Nov 5 16:38:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 2007000 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=quicinc.com header.i=@quicinc.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=GVnyLLwO; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XjYtz5DgPz1xxN for ; Wed, 6 Nov 2024 03:38:51 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 74249385772D for ; Tue, 5 Nov 2024 16:38:49 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by sourceware.org (Postfix) with ESMTPS id 889DA3858CD9 for ; Tue, 5 Nov 2024 16:38:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 889DA3858CD9 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 889DA3858CD9 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=1730824711; cv=none; b=Jx4EZXqP/dPiQ5Ckdos8AtweqyzbSLiT3Yhz6yHsjE9R6fd3DJas34GaeO8f9Tg/8JoDi2K1Ku3vCD1fWcSEuFXb3I/qd+HOpN1kpdPpmynMfO6gyfNOGy0oySvLlsTo32rNVQQnPADsgYhxvirlYxzwQpfJ+/iRcphBRSkliwI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730824711; c=relaxed/simple; bh=UfC3ScFSrXPTWG7qRyLmp2gvSSGyc5U2pXq+E1Obnjk=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=gGt6cjJnfSD+mbgR5YZVh8Ek2ILa29GJCGZWcHSvzwp2eMYtBdw5i2UE2qNZ21xbItKHw8g4Ue1otiVvnv6et44AA1Lj2BnxjLElmrUiZ8J2wyfrpewFK6xqTqQfhTsWa7jfh6nljliiSb09O8l2Cy1XoycjnQiFUeobMjnLVDY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A5ADIar015629 for ; Tue, 5 Nov 2024 16:38:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=qcppdkim1; bh=MolPUgpXni2rXf6QgqE6K4 42voJrE1shOfW0H4oM3/0=; b=GVnyLLwOo1QhihJbkGgQ0ZCXTjoPDz5c6aiAJn 1jTTBj8uEdqNPGyFOgfJM3dJd7R7YYmyiqpxXzrdybO16X/w7qClIx+fPBtS7ceX +L7oBNZSCYROKup+xhUw+xO93C//OTp6OfzQcODIEGCgScKOrxb4qLlH6/GrcrGr JrAm59YhWuDuFNkaqorlZIeaefXPul0jBszyHwmRPIkBV7y7v3/0lZls337yQlEY at5agYhgiLlzNZC9pgOFKEuDdaPQStJYHsyjVKSrTIUjP//b6xm23Q8fxBT22TCl vyiI4EZ8xmsJWw6qNkXJt7jrx5JcwZl/tcNXghu8CP/zDZtg== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 42q5n8jv53-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 05 Nov 2024 16:38:26 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA02.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 4A5GcPbA003582 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 5 Nov 2024 16:38:25 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.1544.9; Tue, 5 Nov 2024 08:38:25 -0800 From: Andrew Pinski To: CC: Andrew Pinski Subject: [PATCH] c: gimplefe: Only allow an identifier before ? [PR117445] Date: Tue, 5 Nov 2024 08:38:12 -0800 Message-ID: <20241105163812.795560-1-quic_apinski@quicinc.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 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-GUID: SbOtMsYQK6w3bjthMccpAm2_l0Lj-0d2 X-Proofpoint-ORIG-GUID: SbOtMsYQK6w3bjthMccpAm2_l0Lj-0d2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 mlxlogscore=661 mlxscore=0 priorityscore=1501 bulkscore=0 adultscore=0 malwarescore=0 phishscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411050128 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~incoming=patchwork.ozlabs.org@gcc.gnu.org Since r13-707-g68e0063397ba82, COND_EXPR/VEC_COND_EXPR has not allowed a comparison as the first operand but the gimple front-end was not updated for this change and you would error out later on. An assert was added with r15-4791-gb60031e8f9f8fe which meant an ICE would happen from the gimple FE. This removes support for parsing of the `?:` expressions except for an identifier. Bootstrapped and tested on x86_64-linux-gnu. gcc/c/ChangeLog: PR c/117445 * gimple-parser.cc (c_parser_gimple_statement): Remove support for comparisons before the querry (`?`) token. Signed-off-by: Andrew Pinski --- gcc/c/gimple-parser.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/gcc/c/gimple-parser.cc b/gcc/c/gimple-parser.cc index 8d505084a8a..7e445ce2ff8 100644 --- a/gcc/c/gimple-parser.cc +++ b/gcc/c/gimple-parser.cc @@ -880,11 +880,9 @@ c_parser_gimple_statement (gimple_parser &parser, gimple_seq *seq) if (lhs.value != error_mark_node && rhs.value != error_mark_node) { - /* If we parsed a comparison or an identifier and the next token - is a '?' then parse a conditional expression. */ - if ((COMPARISON_CLASS_P (rhs.value) - || SSA_VAR_P (rhs.value)) - && c_parser_next_token_is (parser, CPP_QUERY)) + /* If we parsed an identifier and the next token is a '?' then parse + a conditional expression. */ + if (SSA_VAR_P (rhs.value) && c_parser_next_token_is (parser, CPP_QUERY)) { struct c_expr trueval, falseval; c_parser_consume_token (parser);