From 0c4c4d07d87e5cef666cb96ac53f294a5894f92d Mon Sep 17 00:00:00 2001 From: Harald van Dijk Date: Wed, 15 Jan 2025 11:18:20 +0000 Subject: [PATCH] [compiler] Avoid out of bounds access. If !isScan, ivs1 is not guaranteed to hold at least two items and we could fail trying to retrieve ivs1[1] even if the result would be unused. --- .../compiler_pipeline/source/work_item_loops_pass.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/compiler/compiler_pipeline/source/work_item_loops_pass.cpp b/modules/compiler/compiler_pipeline/source/work_item_loops_pass.cpp index 4584a745e..74546cff2 100644 --- a/modules/compiler/compiler_pipeline/source/work_item_loops_pass.cpp +++ b/modules/compiler/compiler_pipeline/source/work_item_loops_pass.cpp @@ -1024,7 +1024,9 @@ struct ScheduleGenerator { mainPreheaderBB = nullptr; mainExitBB = block; nextSubgroupIV = ivs1[0]; - nextScanIV = ivs1[1]; + if (isScan) { + nextScanIV = ivs1[1]; + } } } else { mainPreheaderBB = BasicBlock::Create(