Opened 11 years ago
Last modified 10 years ago
#5538 new Bugs
boost.mpi miscompiles with gcc4.6 and option -std=c++0x
Reported by: | Owned by: | Matthias Troyer | |
---|---|---|---|
Milestone: | To Be Determined | Component: | mpi |
Version: | Boost 1.46.1 | Severity: | Regression |
Keywords: | mpi stdc=c++0x | Cc: | christophe.prudhomme@…, thomas.taylor@…, mateusz@… |
Description
Hello
boost.mpi with gcc-4.6 and the option -std=c++0x don't get well together here is a very simple example
#include <boost/mpi.hpp>
the issue arises with the use of the -std=c++0x flag to use
the new c++ standard. It use to work properly with previous g++ version
compile without -std=c++0x g++ -I/usr/include/mpi -c t.cpp no errors
try compiling with -std=c++0x
g++ -I/usr/include/mpi -std=c++0x -c t.cpp
2011-05-12 22:40:17
prudhomm pts/28 In file included from /usr/include/c++/4.6/memory:67:0,
from /usr/include/boost/mpi/allocator.hpp:18, from /usr/include/boost/mpi.hpp:22, from t.cpp:3:
/usr/include/c++/4.6/bits/stl_uninitialized.h: In function ‘void std::uninitialized_default_n_a(_ForwardIterator, _Size, _Allocator&) [with _ForwardIterator = char*, _Size = long unsigned int, _Allocator
boost::mpi::allocator<char>]’:
/usr/include/c++/4.6/bits/vector.tcc:474:8: instantiated from ‘void std::vector<_Tp, _Alloc>::_M_default_append(std::vector<_Tp, _Alloc>::size_type) [with _Tp = char, _Alloc = boost::mpi::allocator<char>, std::vector<_Tp, _Alloc>::size_type = long unsigned int]’ /usr/include/c++/4.6/bits/stl_vector.h:592:4: instantiated from ‘void std::vector<_Tp, _Alloc>::resize(std::vector<_Tp, _Alloc>::size_type) [with _Tp = char, _Alloc = boost::mpi::allocator<char>, std::vector<_Tp, _Alloc>::size_type = long unsigned int]’ /usr/include/boost/mpi/detail/packed_oprimitive.hpp:96:46: instantiated from here /usr/include/c++/4.6/bits/stl_uninitialized.h:576:6: error: no matching function for call to ‘boost::mpi::allocator<char>::construct(char*)’ /usr/include/c++/4.6/bits/stl_uninitialized.h:576:6: note: candidate is: /usr/include/boost/mpi/allocator.hpp:168:8: note: void boost::mpi::allocator<T>::construct(boost::mpi::allocator<T>::pointer, const T&) [with T = char, boost::mpi::allocator<T>::pointer = char*] /usr/include/boost/mpi/allocator.hpp:168:8: note: candidate expects 2 arguments, 1 provided
Change History (8)
comment:1 by , 11 years ago
Cc: | added |
---|
comment:2 by , 11 years ago
comment:3 by , 11 years ago
This is a GCC 4.6 bug that only affects -std=c++0x mode.
In C++0x mode we assume all allocators provide the C++11 allocator interface, which is a bad assumption. The fix (which I've implemented in GCC 4.7) is to use std::allocator_traits to support allocators without the full interface.
I'm going to open a GCC bug and will update this ticket with a link.
A workaround is to provide construct(pointer) in the MPI allocator, or even to provide the C++11-style:
template<typename... Args> void construct(T*, Args&&...);
comment:5 by , 11 years ago
Cc: | added |
---|
comment:6 by , 11 years ago
Jonathan has fixed the GCC Bug 51626 linked above. The fix will be in GCC 4.6.3
comment:8 by , 10 years ago
Owner: | changed from | to
---|
My fix for this was to define a corresponding member function of the class allocator in boost/mpi/allocator.h: