From b1efd481b4d656213e4c02ccc7e9a7991a8630f3 Mon Sep 17 00:00:00 2001 From: CGH0S7 <776459475@qq.com> Date: Mon, 4 Aug 2025 17:34:05 +0800 Subject: [PATCH] =?UTF-8?q?[midend]BinaryExpStack=E8=A1=A8=E8=BE=BE?= =?UTF-8?q?=E5=BC=8F=E5=BC=B9=E5=87=BA=E9=83=A8=E5=88=86=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/midend/SysYIRGenerator.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/midend/SysYIRGenerator.cpp b/src/midend/SysYIRGenerator.cpp index 2e0e910..50c4114 100644 --- a/src/midend/SysYIRGenerator.cpp +++ b/src/midend/SysYIRGenerator.cpp @@ -262,10 +262,12 @@ void SysYIRGenerator::compute() { } // 弹出BinaryExpStack的表达式 - while(begin < end) { + int count = end - begin; + for (int i = 0; i < count; i++) { BinaryExpStack.pop_back(); - BinaryExpLenStack.back()--; - end--; + } + if (!BinaryExpLenStack.empty()) { + BinaryExpLenStack.back() -= count; } // 计算后缀表达式