From 4d6f63dcb7bac2905bfd0e54b6d4d37d719e7530 Mon Sep 17 00:00:00 2001 From: Julian Brost Date: Mon, 13 Jul 2026 10:19:57 +0200 Subject: [PATCH] Work around a compiler segfault on SLES 15.7 aarch64 Revert "Make `Dictionary::Remove(Iterator)` return the next iterator" and change the one location that now made use of that return value to increment the iterator itself beforehand. I don't see anything that would be wrong with the previous code and I'm pretty certain this is a compiler bug. While at it, I've also removed a stray semicolon and changed the increment in the other branch to the prefix operator as the value is discarded. [35/151] Building CXX object lib/base/CMakeFiles/base.dir/base_unity.cpp.o FAILED: lib/base/CMakeFiles/base.dir/base_unity.cpp.o /usr/bin/c++ -DBOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT -DBOOST_COROUTINES_NO_DEPRECATION_WARNING -DBOOST_FILESYSTEM_NO_DEPRECATED -DOPENSSL_SUPPRESS_DEPRECATED -D_GNU_SOURCE -I/builds/packages/icinga2/packaging/sles/15.7/BUILD/icinga2-2.16.3+111.g8ff3d586f -I/builds/packages/icinga2/packaging/sles/15.7/BUILD/icinga2-2.16.3+111.g8ff3d586f/lib -isystem /builds/packages/icinga2/packaging/sles/15.7/BUILD/icinga2-2.16.3+111.g8ff3d586f/third-party/nlohmann_json -isystem /builds/packages/icinga2/packaging/sles/15.7/BUILD/icinga2-2.16.3+111.g8ff3d586f/third-party/utf8cpp/source -isystem /builds/packages/icinga2/packaging/sles/15.7/BUILD/icinga2-2.16.3+111.g8ff3d586f/third-party/mmatch -isystem /builds/packages/icinga2/packaging/sles/15.7/BUILD/icinga2-2.16.3+111.g8ff3d586f/third-party/socketpair -O2 -g -Wsuggest-override -g -pthread -Winvalid-pch -O2 -g -DNDEBUG -std=c++1z -MD -MT lib/base/CMakeFiles/base.dir/base_unity.cpp.o -MF lib/base/CMakeFiles/base.dir/base_unity.cpp.o.d -o lib/base/CMakeFiles/base.dir/base_unity.cpp.o -c /builds/packages/icinga2/packaging/sles/15.7/BUILD/icinga2-2.16.3+111.g8ff3d586f/lib/base/base_unity.cpp In file included from /builds/packages/icinga2/packaging/sles/15.7/BUILD/icinga2-2.16.3+111.g8ff3d586f/lib/base/configobject.cpp:8:0, from /builds/packages/icinga2/packaging/sles/15.7/BUILD/icinga2-2.16.3+111.g8ff3d586f/lib/base/base_unity.cpp:9: /builds/packages/icinga2/packaging/sles/15.7/BUILD/icinga2-2.16.3+111.g8ff3d586f/lib/base/serializer.hpp:20:14: warning: 'virtual const char* icinga::CircularReferenceError::what() const' can be marked override [-Wsuggest-override] const char *what(void) const throw() final; ^~~~ In file included from /builds/packages/icinga2/packaging/sles/15.7/BUILD/icinga2-2.16.3+111.g8ff3d586f/lib/base/filelogger-ti.hpp:12:0, from /builds/packages/icinga2/packaging/sles/15.7/BUILD/icinga2-2.16.3+111.g8ff3d586f/lib/base/filelogger.hpp:8, from /builds/packages/icinga2/packaging/sles/15.7/BUILD/icinga2-2.16.3+111.g8ff3d586f/lib/base/filelogger.cpp:4, from /builds/packages/icinga2/packaging/sles/15.7/BUILD/icinga2-2.16.3+111.g8ff3d586f/lib/base/base_unity.cpp:25: /builds/packages/icinga2/packaging/sles/15.7/BUILD/icinga2-2.16.3+111.g8ff3d586f/lib/base/streamlogger.hpp:33:7: warning: 'virtual void icinga::StreamLogger::ProcessLogEntry(const icinga::LogEntry&)' can be marked override [-Wsuggest-override] void ProcessLogEntry(const LogEntry& entry) final; ^~~~~~~~~~~~~~~ /builds/packages/icinga2/packaging/sles/15.7/BUILD/icinga2-2.16.3+111.g8ff3d586f/lib/base/streamlogger.hpp:34:7: warning: 'virtual void icinga::StreamLogger::Flush()' can be marked override [-Wsuggest-override] void Flush() final; ^~~~~ In file included from /builds/packages/icinga2/packaging/sles/15.7/BUILD/icinga2-2.16.3+111.g8ff3d586f/lib/config/configitem.hpp:8:0, from /builds/packages/icinga2/packaging/sles/15.7/BUILD/icinga2-2.16.3+111.g8ff3d586f/lib/base/scriptutils.cpp:17, from /builds/packages/icinga2/packaging/sles/15.7/BUILD/icinga2-2.16.3+111.g8ff3d586f/lib/base/base_unity.cpp:56: /builds/packages/icinga2/packaging/sles/15.7/BUILD/icinga2-2.16.3+111.g8ff3d586f/lib/config/expression.hpp:264:19: warning: 'virtual const icinga::DebugInfo& icinga::DebuggableExpression::GetDebugInfo() const' can be marked override [-Wsuggest-override] const DebugInfo& GetDebugInfo() const final; ^~~~~~~~~~~~ In file included from /builds/packages/icinga2/packaging/sles/15.7/BUILD/icinga2-2.16.3+111.g8ff3d586f/lib/base/base_unity.cpp:78:0: /builds/packages/icinga2/packaging/sles/15.7/BUILD/icinga2-2.16.3+111.g8ff3d586f/lib/base/workqueue.cpp:80:1: internal compiler error: Segmentation fault } ^ Please submit a full bug report, with preprocessed source if appropriate. See for instructions. This reverts commit 3cb6e5a15212d43491d58c7696c32b5ed0f23675. --- lib/base/dictionary.cpp | 5 ++--- lib/base/dictionary.hpp | 2 +- lib/remote/apilistener-configsync.cpp | 6 +++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/base/dictionary.cpp b/lib/base/dictionary.cpp index 34a0fac15f9..c679fd92bba 100644 --- a/lib/base/dictionary.cpp +++ b/lib/base/dictionary.cpp @@ -155,9 +155,8 @@ Dictionary::Iterator Dictionary::End() * Removes the item specified by the iterator from the dictionary. * * @param it The iterator. - * @return an iterator to the element after the removed element. */ -Dictionary::Iterator Dictionary::Remove(Dictionary::Iterator it) +void Dictionary::Remove(Dictionary::Iterator it) { ASSERT(OwnsLock()); std::unique_lock lock (m_DataMutex); @@ -165,7 +164,7 @@ Dictionary::Iterator Dictionary::Remove(Dictionary::Iterator it) if (m_Frozen) BOOST_THROW_EXCEPTION(std::invalid_argument("Dictionary must not be modified.")); - return m_Data.erase(it); + m_Data.erase(it); } /** diff --git a/lib/base/dictionary.hpp b/lib/base/dictionary.hpp index 13ed90feaec..f9d85b907ac 100644 --- a/lib/base/dictionary.hpp +++ b/lib/base/dictionary.hpp @@ -56,7 +56,7 @@ class Dictionary final : public Object void Remove(const String& key); - Iterator Remove(Iterator it); + void Remove(Iterator it); void Clear(); diff --git a/lib/remote/apilistener-configsync.cpp b/lib/remote/apilistener-configsync.cpp index 8dde8de29aa..9c5d226a673 100644 --- a/lib/remote/apilistener-configsync.cpp +++ b/lib/remote/apilistener-configsync.cpp @@ -580,10 +580,10 @@ void ApiListener::PruneDeletedRuntimeObjects() for (auto it = deletedRuntimeObjects->Begin(); it != deletedRuntimeObjects->End();) { if (it->second < cutoff) { - it = deletedRuntimeObjects->Remove(it); + deletedRuntimeObjects->Remove(it++); } else { - it++; - }; + ++it; + } } }