From patchwork Sun Nov 5 18:27:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 161750 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp2254450vqu; Sun, 5 Nov 2023 10:27:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IHydrKhVsCWdQbEBjLxRFFLwNsx6n4hOoGszhZ0S4fC4jzwyy7RMVb8PayEzid6NO+x0BTs X-Received: by 2002:a05:620a:4441:b0:778:b029:100c with SMTP id w1-20020a05620a444100b00778b029100cmr34982487qkp.66.1699208866548; Sun, 05 Nov 2023 10:27:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699208866; cv=pass; d=google.com; s=arc-20160816; b=M/1kh1OBLSl3cXjPcfbwNCPaB6TO9v5SHtaExn2eBDl2/BMp10x6mxLViFOmk8kWhf 1yNT9uO+brPwqmAoHduskArSIoEfmiermoB6VpoXQe38sXi7ACeeSndgFNXvFTPGco+A OJWUQoOsJVQDSUoNPvSw0X+XNecbBBhdtespEQTqh+0WtGHGPcUNDe4q2q93BPsI+MN2 9FkH5ioG3qW6ftaVBr7ftyU8Z2eMWP1mHp/K+zvjPXzczvddw/LYZu/IqO38BXU8GoHG wwHbP0zR+c/AZ/ozr5Pe0sU1GbMpNvBwEZ7u/i+SCasLnLm45xT32KwNFC0FV0FZyrwB nswA== 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:mime-version:user-agent :message-id:date:subject:mail-followup-to:to:from:arc-filter :dmarc-filter:delivered-to; bh=uWolhiqd9jXs3p07lb46Y0BuLchxhXQdrwPMreuzzSQ=; fh=hPrbWPhweUx4V0GV9uXJqbyAzg2ABmTz7kczrAQqMmM=; b=lUdSutsRjxU8q/BMF5KMLiej0uyydbBzruwgqsBi3a3GdPnJucIiD+bO7kkF+kjbh+ wHHXpOcVUstphlf5enWs/TEyJnN8IWGDKNY4/eJGy19fgUXlyafMl8kA7sq3diWyopCv //LorjkWoD3MRu0AgPd5zkPgg+BTV/QSLObbOuYH6ZivAAFEorScy6WLZ86TKrW2sbKU 6Xu7TK0uMhOREwQapKe4706icjkg/IqqH1LM5B3IsF3xY3XsjYAqV3KpCBG5lzcNgkUn 6cLMhybPuDIyF3sLTczCDNYfc54CLdD5A9PbqzljqS4p0SlULAZktHJ5pUpcxL3Pl/hJ SAZg== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id z17-20020a05620a261100b0076f08f689e5si4742619qko.502.2023.11.05.10.27.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Nov 2023 10:27:46 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 540B63856DE8 for ; Sun, 5 Nov 2023 18:27:46 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id EF1493858CDB for ; Sun, 5 Nov 2023 18:27:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EF1493858CDB Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EF1493858CDB Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699208844; cv=none; b=CIHGFIPw+hALSTlZ47n0dTkGk0bUdfGX0CVm5ChAE/aHrdqy+LxVcR0h6U4cGPt2QD9OJ7aVID1V2leERoplbyYeCDR/BUurOgR8XeiJPsjzKjoNJcSxWjQQpviyy8nsEb8+7NyhSsn9eTdNfFQaVISQdij5vBYEhvix16vL70o= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699208844; c=relaxed/simple; bh=fcROdLfjjeM6d1DfZf4YpI21H+sTut01YLASHGlBUvo=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=YlSnlZARjMz6oFNW5KbK3W6o39w2V9vkchlgw+q0Uc7B0hg7PG+kFIF75WOONy7r4xdZ/Fnb6G8Ew5J+89Rdxkc6NDZ1hbkPhMFEqtgKnJPivBSiTDCmwN0Ojpao99PViQkSbgN6SYpYyLlUHrIW8vmc1NKZTwqQyDT717xXMzM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 48328C15 for ; Sun, 5 Nov 2023 10:28:04 -0800 (PST) Received: from localhost (e121540-lin.manchester.arm.com [10.32.110.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1CD8C3F703 for ; Sun, 5 Nov 2023 10:27:20 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [pushed] read-rtl: Fix infinite loop while parsing [...] Date: Sun, 05 Nov 2023 18:27:03 +0000 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Spam-Status: No, score=-23.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781749636462956699 X-GMAIL-MSGID: 1781749636462956699 read_rtx_operand would spin endlessly for: (unspec [(...))] UNSPEC_FOO) because read_nested_rtx does nothing if the next character is not '('. Pushed after testing on aarch64-linux-gnu & x86_&4-linux-gnu. Richard gcc/ * read-rtl.cc (read_rtx_operand): Avoid spinning endlessly for invalid [...] operands. --- gcc/read-rtl.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gcc/read-rtl.cc b/gcc/read-rtl.cc index 292f8b72d43..f3b5613dfdb 100644 --- a/gcc/read-rtl.cc +++ b/gcc/read-rtl.cc @@ -1896,8 +1896,10 @@ rtx_reader::read_rtx_operand (rtx return_rtx, int idx) repeat_count--; value = saved_rtx; } - else + else if (c == '(') value = read_nested_rtx (); + else + fatal_with_file_and_line ("unexpected character in vector"); for (; repeat_count > 0; repeat_count--) {