From fcfdc56cc27e7e0246633de43720cb1f57c34e28 Mon Sep 17 00:00:00 2001 From: Michael Klimenko Date: Sun, 28 Jan 2024 16:43:11 +0100 Subject: [PATCH] Add comment regarding fixed UB --- common/common.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/common/common.cpp b/common/common.cpp index 7a9583b65..459d352ae 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -1700,6 +1700,7 @@ void dump_kv_cache_view_seqs(const llama_kv_cache_view & view, int row_size) { if (cs_curr[j] < 0) { continue; } if (seqs.find(cs_curr[j]) == seqs.end()) { if (seqs.size() + 1 >= sizeof(slot_chars)) { break; } + // combining the following two lines will result in an UB: https://pvs-studio.com/en/docs/warnings/v708/ auto current_size = seqs.size(); seqs[cs_curr[j]] = current_size; }