strus icon indicating copy to clipboard operation
strus copied to clipboard

gcc 7.1 warning

Open andreasbaumann opened this issue 8 years ago • 4 comments
trafficstars

[ 23%] Building CXX object src/storage/CMakeFiles/strus_storage_static.dir/forwardIndexMap.cpp.o
In file included from /usr/include/c++/7.2.0/map:60:0,
                 from /data/work/strus/strus/src/storage/forwardIndexBlock.hpp:13,
                 from /data/work/strus/strus/src/storage/forwardIndexMap.hpp:11,
                 from /data/work/strus/strus/src/storage/forwardIndexMap.cpp:8:
/usr/include/c++/7.2.0/bits/stl_tree.h: In function 'std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_emplace_hint_unique(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator, _Args&& ...) [with _Args = {const std::piecewise_construct_t&, std::tuple<const strus::ForwardIndexMap::MapKey&>, std::tuple<>}; _Key = strus::ForwardIndexMap::MapKey; _Val = std::pair<const strus::ForwardIndexMap::MapKey, unsigned int>; _KeyOfValue = std::_Select1st<std::pair<const strus::ForwardIndexMap::MapKey, unsigned int> >; _Compare = std::less<strus::ForwardIndexMap::MapKey>; _Alloc = strus::LocalStructAllocator<std::pair<const strus::ForwardIndexMap::MapKey, unsigned int> >]':
/usr/include/c++/7.2.0/bits/stl_tree.h:2395:7: note: parameter passing for argument of type 'std::_Rb_tree<strus::ForwardIndexMap::MapKey, std::pair<const strus::ForwardIndexMap::MapKey, unsigned int>, std::_Select1st<std::pair<const strus::ForwardIndexMap::MapKey, unsigned int> >, std::less<strus::ForwardIndexMap::MapKey>, strus::LocalStructAllocator<std::pair<const strus::ForwardIndexMap::MapKey, unsigned int> > >::const_iterator {aka std::_Rb_tree_const_iterator<std::pair<const strus::ForwardIndexMap::MapKey, unsigned int> >}' changed in GCC 7.1
       _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/7.2.0/map:61:0,
                 from /data/work/strus/strus/src/storage/forwardIndexBlock.hpp:13,
                 from /data/work/strus/strus/src/storage/forwardIndexMap.hpp:11,
                 from /data/work/strus/strus/src/storage/forwardIndexMap.cpp:8:
/usr/include/c++/7.2.0/bits/stl_map.h: In member function 'void strus::ForwardIndexMap::closeCurblock(const Index&, strus::ForwardIndexMap::CurblockElemList&)':
/usr/include/c++/7.2.0/bits/stl_map.h:493:4: note: parameter passing for argument of type 'std::_Rb_tree<strus::ForwardIndexMap::MapKey, std::pair<const strus::ForwardIndexMap::MapKey, unsigned int>, std::_Select1st<std::pair<const strus::ForwardIndexMap::MapKey, unsigned int> >, std::less<strus::ForwardIndexMap::MapKey>, strus::LocalStructAllocator<std::pair<const strus::ForwardIndexMap::MapKey, unsigned int> > >::const_iterator {aka std::_Rb_tree_const_iterator<std::pair<const strus::ForwardIndexMap::MapKey, unsigned int> >}' changed in GCC 7.1
    __i = _M_t._M_emplace_hint_unique(__i, std::piecewise_construct,
    ^~~
/usr/include/c++/7.2.0/bits/stl_map.h: In member function 'void strus::ForwardIndexMap::renameNewDocNumbers(const std::map<int, int>&)':
/usr/include/c++/7.2.0/bits/stl_map.h:493:4: note: parameter passing for argument of type 'std::_Rb_tree<strus::ForwardIndexMap::MapKey, std::pair<const strus::ForwardIndexMap::MapKey, unsigned int>, std::_Select1st<std::pair<const strus::ForwardIndexMap::MapKey, unsigned int> >, std::less<strus::ForwardIndexMap::MapKey>, strus::LocalStructAllocator<std::pair<const strus::ForwardIndexMap::MapKey, unsigned int> > >::const_iterator {aka std::_Rb_tree_const_iterator<std::pair<const strus::ForwardIndexMap::MapKey, unsigned int> >}' changed in GCC 7.1
    __i = _M_t._M_emplace_hint_unique(__i, std::piecewise_construct,
    ^~~

compiled on ARM, but should happen on other platforms too.

Can this be fixed in a way not to break on older gcc's, I wonder.

andreasbaumann avatar Oct 01 '17 07:10 andreasbaumann

Or is this a bug in the STL?

andreasbaumann avatar Oct 01 '17 07:10 andreasbaumann

https://gcc.gnu.org/ml/gcc/2017-05/msg00073.html

Seems to be a GCC 6 to 7 ABI incompatibility warning.

If the code runs correctly on ARM, I think it's safe to ignore those warnings.

andreasbaumann avatar Oct 01 '17 08:10 andreasbaumann

On the other hand it also means that things are exposed in public APIs of strus, which break if you don't use the same compiler major version to compile them.

andreasbaumann avatar Oct 01 '17 08:10 andreasbaumann

Tried to avoid this specific parameter passing of a tree value as reference in order to fix this bug.

patrickfrey avatar Dec 04 '17 15:12 patrickfrey