diff --git a/BaseLib/Algorithm.h b/BaseLib/Algorithm.h
index f613f1d7c11fd1de988c5b4e9eb0a528076c8636..371f14622cd6648338cca23e9ea0e26c33e90965 100644
--- a/BaseLib/Algorithm.h
+++ b/BaseLib/Algorithm.h
@@ -21,6 +21,7 @@
 #include <typeinfo>
 #include <utility>
 
+#include "CompilerWorkarounds.h"
 #include "Error.h"
 
 namespace BaseLib
@@ -110,8 +111,8 @@ void insertIfKeyUniqueElseError(Map& map, Key const& key, Value&& value,
 //! otherwise an \c error_message is printed and the program is aborted.
 //! Cf. also the const overload below.
 template <typename Map, typename Key>
-typename Map::mapped_type& getOrError(Map& map, Key const& key,
-                                      std::string const& error_message)
+OGS_NO_DANGLING typename Map::mapped_type& getOrError(
+    Map& map, Key const& key, std::string const& error_message)
 {
     auto it = map.find(key);
     if (it == map.end())
@@ -131,8 +132,8 @@ typename Map::mapped_type& getOrError(Map& map, Key const& key,
 }
 //! \overload
 template <typename Map, typename Key>
-typename Map::mapped_type const& getOrError(Map const& map, Key const& key,
-                                            std::string const& error_message)
+OGS_NO_DANGLING typename Map::mapped_type const& getOrError(
+    Map const& map, Key const& key, std::string const& error_message)
 {
     auto it = map.find(key);
     if (it == map.end())
@@ -155,7 +156,7 @@ typename Map::mapped_type const& getOrError(Map const& map, Key const& key,
 //! the \c predicate exists;
 //! otherwise an \c error_message is printed and the program is aborted.
 template <typename Container, typename Predicate>
-typename Container::value_type const& getIfOrError(
+OGS_NO_DANGLING typename Container::value_type const& getIfOrError(
     Container const& container,
     Predicate&& predicate,
     std::string const& error_message)
diff --git a/BaseLib/CompilerWorkarounds.h b/BaseLib/CompilerWorkarounds.h
new file mode 100644
index 0000000000000000000000000000000000000000..479d270a82e86bc7f1dc3446b1fea248a27cdd4d
--- /dev/null
+++ b/BaseLib/CompilerWorkarounds.h
@@ -0,0 +1,16 @@
+/**
+ * \file
+ * \copyright
+ * Copyright (c) 2012-2024, OpenGeoSys Community (http://www.opengeosys.org)
+ *            Distributed under a Modified BSD License.
+ *              See accompanying file LICENSE.txt or
+ *              http://www.opengeosys.org/project/license
+ */
+
+#pragma once
+
+#if defined(__GNUC__) && __GNUC__ == 14
+#define OGS_NO_DANGLING [[gnu::no_dangling]]
+#else
+#define OGS_NO_DANGLING
+#endif
diff --git a/MeshGeoToolsLib/MeshNodeSearcher.h b/MeshGeoToolsLib/MeshNodeSearcher.h
index 9aa05163b8046524b6305975594ee11e45efae63..834a37a6229270e27bf6521f22a08e198a095d2b 100644
--- a/MeshGeoToolsLib/MeshNodeSearcher.h
+++ b/MeshGeoToolsLib/MeshNodeSearcher.h
@@ -13,6 +13,7 @@
 #include <memory>
 #include <vector>
 
+#include "BaseLib/CompilerWorkarounds.h"
 #include "GeoLib/Grid.h"
 #include "MathLib/Point3dWithID.h"
 #include "MeshGeoToolsLib/SearchAllNodes.h"
@@ -87,10 +88,11 @@ public:
      * Returns a (possibly new) mesh node searcher for the mesh.
      * A new one will be created, if it does not already exists.
      */
-    static MeshNodeSearcher const& getMeshNodeSearcher(
-        MeshLib::Mesh const& mesh,
-        std::unique_ptr<MeshGeoToolsLib::SearchLength>&&
-            search_length_algorithm);
+    OGS_NO_DANGLING
+    static MeshNodeSearcher const&
+    getMeshNodeSearcher(MeshLib::Mesh const& mesh,
+                        std::unique_ptr<MeshGeoToolsLib::SearchLength>&&
+                            search_length_algorithm);
 
 private:
     MeshLib::Mesh const& _mesh;
diff --git a/ParameterLib/Utils.h b/ParameterLib/Utils.h
index d459cc021aa7a1ec0166eae1d1d8c58b20af5557..ef1580fbfaf8fc17a36dc0188aa0c829046001d1 100644
--- a/ParameterLib/Utils.h
+++ b/ParameterLib/Utils.h
@@ -12,6 +12,7 @@
 
 #include <vector>
 
+#include "BaseLib/CompilerWorkarounds.h"
 #include "BaseLib/ConfigTree.h"
 #include "BaseLib/Error.h"
 #include "Parameter.h"
@@ -98,10 +99,11 @@ Parameter<ParameterDataType>* findParameterOptional(
 ///
 /// \see The documentation of the other findParameter() function.
 template <typename ParameterDataType>
-Parameter<ParameterDataType>& findParameter(
+OGS_NO_DANGLING Parameter<ParameterDataType>& findParameter(
     std::string const& parameter_name,
     std::vector<std::unique_ptr<ParameterBase>> const& parameters,
-    int const num_components, MeshLib::Mesh const* const mesh = nullptr)
+    int const num_components,
+    MeshLib::Mesh const* const mesh = nullptr)
 {
     auto* parameter = findParameterOptional<ParameterDataType>(
         parameter_name, parameters, num_components, mesh);
@@ -130,10 +132,12 @@ Parameter<ParameterDataType>& findParameter(
 /// and return a reference to that parameter. Additionally it checks for the
 /// type of the found parameter.
 template <typename ParameterDataType>
-Parameter<ParameterDataType>& findParameter(
-    BaseLib::ConfigTree const& process_config, std::string const& tag,
+OGS_NO_DANGLING Parameter<ParameterDataType>& findParameter(
+    BaseLib::ConfigTree const& process_config,
+    std::string const& tag,
     std::vector<std::unique_ptr<ParameterBase>> const& parameters,
-    int const num_components, MeshLib::Mesh const* const mesh = nullptr)
+    int const num_components,
+    MeshLib::Mesh const* const mesh = nullptr)
 {
     // Find parameter name in process config.
     //! \ogs_file_special