This is an automated email from the ASF dual-hosted git repository.

bneradt pushed a commit to branch icc-update
in repository https://gitbox.apache.org/repos/asf/trafficserver-libswoc.git

commit 7b83f2e73c36638e6b626fbb776b327927169ace
Author: Alan M. Carroll <[email protected]>
AuthorDate: Wed Jun 24 14:53:22 2020 -0500

    Workaround nullptr reference problem.
---
 code/include/swoc/swoc_ip.h | 9 +++++----
 code/src/swoc_ip.cc         | 2 ++
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/code/include/swoc/swoc_ip.h b/code/include/swoc/swoc_ip.h
index 79dcd36..59395a3 100644
--- a/code/include/swoc/swoc_ip.h
+++ b/code/include/swoc/swoc_ip.h
@@ -38,6 +38,7 @@ class IP6Net;
 class IPNet;
 
 using ::std::string_view;
+extern void * const fake_nullptr_for_intel_compiler ;
 
 /** A union to hold @c sockaddr compliant IP address structures.
 
@@ -1556,11 +1557,11 @@ public:
     typename IP4Space::iterator _iter_4; ///< IPv4 sub-space iterator.
     typename IP6Space::iterator _iter_6; ///< IPv6 sub-space iterator.
     /// Current value.
-    value_type _value{IPRange{}, *null_payload};
+    value_type _value{IPRange{}, 
*static_cast<PAYLOAD*>(fake_nullptr_for_intel_compiler)};
 
     /// Dummy payload.
     /// @internal Used to initialize @c value_type for invalid iterators.
-    static constexpr PAYLOAD *null_payload = nullptr;
+//    static constexpr PAYLOAD * const null_payload = nullptr;
 
     /** Internal constructor.
      *
@@ -1731,7 +1732,7 @@ auto IPSpace<PAYLOAD>::const_iterator::operator++() -> 
self_type& {
       return *this;
     }
   }
-  new(&_value) value_type{IPRange{}, *null_payload};
+  new(&_value) value_type{IPRange{}, 
*static_cast<PAYLOAD*>(fake_nullptr_for_intel_compiler)};
   return *this;
 }
 
@@ -1754,7 +1755,7 @@ auto IPSpace<PAYLOAD>::const_iterator::operator--() -> 
self_type& {
     new(&_value) value_type{_iter_4->range(), _iter_4->payload()};
     return *this;
   }
-  new(&_value) value_type{IPRange{}, *null_payload};
+  new(&_value) value_type{IPRange{}, 
*static_cast<PAYLOAD*>(fake_nullptr_for_intel_compiler)};
   return *this;
 }
 
diff --git a/code/src/swoc_ip.cc b/code/src/swoc_ip.cc
index e9d0dc5..38a2dfb 100644
--- a/code/src/swoc_ip.cc
+++ b/code/src/swoc_ip.cc
@@ -44,6 +44,8 @@ IP6Addr const IP6Addr::MIN{0, 0};
 IP6Addr const IP6Addr::MAX{std::numeric_limits<uint64_t>::max()
                            , std::numeric_limits<uint64_t>::max()};
 
+void * const fake_nullptr_for_intel_compiler = 0;
+
 bool
 IPEndpoint::assign(sockaddr *dst, sockaddr const *src) {
   size_t n = 0;

Reply via email to