Skip to content
Snippets Groups Projects
Commit 0bd2dcc4 authored by Christian Godenschwager's avatar Christian Godenschwager
Browse files

Fix buffers for GCC 7 with -O3

parent d3f65d03
Branches
Tags
No related merge requests found
......@@ -38,7 +38,7 @@
#include <boost/utility/enable_if.hpp>
#include <algorithm>
#include <cstring>
namespace walberla {
namespace mpi {
......@@ -389,7 +389,6 @@ inline bool GenericRecvBuffer<T>::isEmpty() const
*/
template< typename T > // Element type
template< typename V > // Type of the built-in data value
ATTRIBUTE_NO_SANITIZE_UNDEFINED
typename boost::enable_if< boost::mpl::or_< boost::is_arithmetic<V>, boost::is_enum<V> >,
GenericRecvBuffer<T> & >::type
GenericRecvBuffer<T>::get( V& value )
......@@ -408,9 +407,8 @@ GenericRecvBuffer<T>::get( V& value )
WALBERLA_ASSERT_LESS_EQUAL( cur_ + (sizeof(V) / sizeof(T)), end_ );
// Extracting the data value
V* tmp = reinterpret_cast<V*>( cur_ );
value = *tmp;
cur_ = reinterpret_cast<T*>( ++tmp );
std::memcpy( &value, cur_, sizeof(V) );
cur_ += sizeof(V) / sizeof(T);
// Invariants check
WALBERLA_ASSERT_LESS_EQUAL( cur_, end_);
......
......@@ -42,7 +42,7 @@
#include <algorithm>
#include <typeinfo>
#include <cstring>
namespace walberla {
namespace mpi {
......@@ -443,7 +443,6 @@ inline bool GenericSendBuffer<T,G>::isEmpty() const
template< typename T // Element type
, typename G > // Growth policy
template< typename V > // Type of the built-in data value
ATTRIBUTE_NO_SANITIZE_UNDEFINED
typename boost::enable_if< boost::mpl::or_< boost::is_arithmetic<V>, boost::is_enum<V> >,
GenericSendBuffer<T,G>& >::type
GenericSendBuffer<T,G>::put( V value )
......@@ -464,8 +463,7 @@ GenericSendBuffer<T,G>::put( V value )
}
// Adding the data value
V* const tmp( reinterpret_cast<V*>( cur_ ) );
*tmp = value;
std::memcpy( cur_, &value, sizeof(V) );
cur_ += count;
// Invariants check
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment