]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
Fix compiler errors with clang21, gcc15/gcc16. (#383)
authorKonstantinos Margaritis <markos@users.noreply.github.com>
Wed, 1 Apr 2026 13:45:56 +0000 (16:45 +0300)
committerGitHub <noreply@github.com>
Wed, 1 Apr 2026 13:45:56 +0000 (16:45 +0300)
* fix-clang21 build error with gtest

* fix gcc15/16 exception when idx2 is larger than src.next.size()

src/nfa/shengcompile.cpp
unit/gtest/gtest-all.cc

index 2fbda9a5f833b500bee6095cd62c05df671ffb38..c85558d0b0a1f8b419cb730b5778964350a41991 100644 (file)
@@ -100,7 +100,9 @@ struct dfa_info {
     }
     dstate &next(dstate_id_t idx, u16 chr) {
         const auto &src = (*this)[idx];
-        auto next_id = src.next[raw.alpha_remap[chr]];
+        const auto idx2 = raw.alpha_remap[chr];
+        if (idx2 >= src.next.size()) return floating;
+        auto next_id = src.next[idx2];
         return states[next_id];
     }
     // get original idx from adjusted idx
index a9a03b2e3b4531e96ef330bfdc4cf4eda0442a98..57766c69d8d3ed4653249fa9f9fd51203d657267 100644 (file)
@@ -7480,7 +7480,7 @@ void StackLowerThanAddress(const void* ptr, bool* result) {
 }
 
 bool StackGrowsDown() {
-  int dummy;
+  int dummy{0};
   bool result;
   StackLowerThanAddress(&dummy, &result);
   return result;