mgmol icon indicating copy to clipboard operation
mgmol copied to clipboard

Incompatibility with gcc 12.1.1

Open dreamer2368 opened this issue 10 months ago • 0 comments

It is observed from LC quartz that the current mgmol is not compatible with gcc 12.1.1. Below is the module list on quartz:

Currently Loaded Modules:
  1) jobutils/1.0   2) texlive/20220321   3) StdEnv (S)   4) git/2.36.1   5) python/3.10.8   6) cmake/3.26.3   7) paraview/5.11.0   8) petsc/3.18.3   9) gcc/12.1.1  10) tbb/2021.6.0  11) mvapich2/2.3.7  12) hdf5-parallel/1.14.0  13) mkl-interfaces/2022.1.0  14) boost/1.80.0

On ghcr-ci-test branch, the following commands compile mgmol well on LC quartz with gcc <= 11.2.1:

mkdir build && cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake_toolchains/quartz.default.cmake
make -j 16

However, with gcc 12.1.1, the following compilation error is returned:

[ 77%] Building CXX object tests/CMakeFiles/testTradeGhostValues.dir/testTradeGhostValues.cc.o
/g/g92/chung28/mgmol/tests/testTradeGhostValues.cc: In function ‘void C_A_T_C_H_T_E_S_T_0()’:
/g/g92/chung28/mgmol/tests/testTradeGhostValues.cc:42:33: error: variable ‘std::array<unsigned int, 3> ngpts1’ has initializer but incomplete type
   42 |         std::array<unsigned, 3> ngpts1{ { 32, 24, 20 } };
      |                                 ^~~~~~
/g/g92/chung28/mgmol/tests/testTradeGhostValues.cc:45:33: error: variable ‘std::array<unsigned int, 3> ngpts2’ has initializer but incomplete type
   45 |         std::array<unsigned, 3> ngpts2{ { 20, 32, 24 } };
      |                                 ^~~~~~
/g/g92/chung28/mgmol/tests/testTradeGhostValues.cc:48:33: error: variable ‘std::array<unsigned int, 3> ngpts3’ has initializer but incomplete type
   48 |         std::array<unsigned, 3> ngpts3{ { 24, 20, 32 } };
      |                                 ^~~~~~
/g/g92/chung28/mgmol/tests/testTradeGhostValues.cc:68:45: error: no match for ‘operator[]’ (operand types are ‘std::array<unsigned int, 3>’ and ‘int’)
   68 |             const unsigned ngpts[3] = { mesh[0], mesh[1], mesh[2] };
      |                                             ^
/g/g92/chung28/mgmol/tests/testTradeGhostValues.cc:68:54: error: no match for ‘operator[]’ (operand types are ‘std::array<unsigned int, 3>’ and ‘int’)
   68 |             const unsigned ngpts[3] = { mesh[0], mesh[1], mesh[2] };
      |                                                      ^
/g/g92/chung28/mgmol/tests/testTradeGhostValues.cc:68:63: error: no match for ‘operator[]’ (operand types are ‘std::array<unsigned int, 3>’ and ‘int’)
   68 |             const unsigned ngpts[3] = { mesh[0], mesh[1], mesh[2] };
      |                                                               ^
In file included from /collab/usr/global/tools/tce4/packages/gcc/gcc-12.1.1/include/c++/12/vector:64,
                 from /g/g92/chung28/mgmol/src/pb/Grid.h:16,
                 from /g/g92/chung28/mgmol/src/pb/FDkernels.h:4,
                 from /g/g92/chung28/mgmol/src/pb/GridFuncVector.h:13,
                 from /g/g92/chung28/mgmol/tests/testTradeGhostValues.cc:9:
/collab/usr/global/tools/tce4/packages/gcc/gcc-12.1.1/include/c++/12/bits/stl_vector.h: In instantiation of ‘std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = std::array<unsigned int, 3>; _Alloc = std::allocator<std::array<unsigned int, 3> >]’:
/collab/usr/global/tools/tce4/packages/gcc/gcc-12.1.1/include/c++/12/bits/stl_vector.h:526:7:   required from here
/collab/usr/global/tools/tce4/packages/gcc/gcc-12.1.1/include/c++/12/bits/stl_vector.h:367:49: error: invalid use of incomplete type ‘struct std::array<unsigned int, 3>’
  367 |                       _M_impl._M_end_of_storage - _M_impl._M_start);
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
In file included from /collab/usr/global/tools/tce4/packages/gcc/gcc-12.1.1/include/c++/12/bits/unique_ptr.h:36,
                 from /collab/usr/global/tools/tce4/packages/gcc/gcc-12.1.1/include/c++/12/memory:76,
                 from /g/g92/chung28/mgmol/src/tools/memory_space.h:22,
                 from /g/g92/chung28/mgmol/src/pb/FDkernels.h:5:
/collab/usr/global/tools/tce4/packages/gcc/gcc-12.1.1/include/c++/12/tuple:1595:45: note: declaration of ‘struct std::array<unsigned int, 3>’
 1595 |   template<typename _Tp, size_t _Nm> struct array;
      |                                             ^~~~~
In file included from /collab/usr/global/tools/tce4/packages/gcc/gcc-12.1.1/include/c++/12/bits/stl_algobase.h:67,
                 from /collab/usr/global/tools/tce4/packages/gcc/gcc-12.1.1/include/c++/12/algorithm:60,
                 from /g/g92/chung28/mgmol/src/pb/Grid.h:13:
/collab/usr/global/tools/tce4/packages/gcc/gcc-12.1.1/include/c++/12/bits/stl_iterator.h: In instantiation of ‘__gnu_cxx::__normal_iterator<_Iterator, _Container>& __gnu_cxx::__normal_iterator<_Iterator, _Container>::operator++() [with _Iterator = std::array<unsigned int, 3>*; _Container = std::vector<std::array<unsigned int, 3> >]’:
/g/g92/chung28/mgmol/tests/testTradeGhostValues.cc:56:27:   required from here
/collab/usr/global/tools/tce4/packages/gcc/gcc-12.1.1/include/c++/12/bits/stl_iterator.h:1107:11: error: cannot increment a pointer to incomplete type ‘std::array<unsigned int, 3>’
 1107 |         ++_M_current;
      |           ^~~~~~~~~~
In file included from /collab/usr/global/tools/tce4/packages/gcc/gcc-12.1.1/include/c++/12/bits/stl_pair.h:60,
                 from /collab/usr/global/tools/tce4/packages/gcc/gcc-12.1.1/include/c++/12/bits/stl_algobase.h:64:
/collab/usr/global/tools/tce4/packages/gcc/gcc-12.1.1/include/c++/12/type_traits: In instantiation of ‘struct std::is_destructible<std::array<unsigned int, 3> >’:
/collab/usr/global/tools/tce4/packages/gcc/gcc-12.1.1/include/c++/12/bits/stl_construct.h:188:51:   required from ‘void std::_Destroy(_ForwardIterator, _ForwardIterator) [with _ForwardIterator = array<unsigned int, 3>*]’
/collab/usr/global/tools/tce4/packages/gcc/gcc-12.1.1/include/c++/12/bits/alloc_traits.h:850:15:   required from ‘void std::_Destroy(_ForwardIterator, _ForwardIterator, allocator<_T2>&) [with _ForwardIterator = array<unsigned int, 3>*; _Tp = array<unsigned int, 3>]’
/collab/usr/global/tools/tce4/packages/gcc/gcc-12.1.1/include/c++/12/bits/stl_vector.h:730:15:   required from ‘std::vector<_Tp, _Alloc>::~vector() [with _Tp = std::array<unsigned int, 3>; _Alloc = std::allocator<std::array<unsigned int, 3> >]’
/g/g92/chung28/mgmol/tests/testTradeGhostValues.cc:40:42:   required from here
/collab/usr/global/tools/tce4/packages/gcc/gcc-12.1.1/include/c++/12/type_traits:910:52: error: static assertion failed: template argument must be a complete class or an unbounded array
  910 |       static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/collab/usr/global/tools/tce4/packages/gcc/gcc-12.1.1/include/c++/12/type_traits:910:52: note: ‘std::__is_complete_or_unbounded<__type_identity<array<unsigned int, 3> > >((std::__type_identity<std::array<unsigned int, 3> >(), std::__type_identity<std::array<unsigned int, 3> >()))’ evaluates to false
In file included from /collab/usr/global/tools/tce4/packages/gcc/gcc-12.1.1/include/c++/12/bits/stl_tempbuf.h:60,
                 from /collab/usr/global/tools/tce4/packages/gcc/gcc-12.1.1/include/c++/12/bits/stl_algo.h:61,
                 from /collab/usr/global/tools/tce4/packages/gcc/gcc-12.1.1/include/c++/12/algorithm:61:
/collab/usr/global/tools/tce4/packages/gcc/gcc-12.1.1/include/c++/12/bits/stl_construct.h: In instantiation of ‘void std::_Destroy(_ForwardIterator, _ForwardIterator) [with _ForwardIterator = array<unsigned int, 3>*]’:
/collab/usr/global/tools/tce4/packages/gcc/gcc-12.1.1/include/c++/12/bits/alloc_traits.h:850:15:   required from ‘void std::_Destroy(_ForwardIterator, _ForwardIterator, allocator<_T2>&) [with _ForwardIterator = array<unsigned int, 3>*; _Tp = array<unsigned int, 3>]’
/collab/usr/global/tools/tce4/packages/gcc/gcc-12.1.1/include/c++/12/bits/stl_vector.h:730:15:   required from ‘std::vector<_Tp, _Alloc>::~vector() [with _Tp = std::array<unsigned int, 3>; _Alloc = std::allocator<std::array<unsigned int, 3> >]’
/g/g92/chung28/mgmol/tests/testTradeGhostValues.cc:40:42:   required from here
/collab/usr/global/tools/tce4/packages/gcc/gcc-12.1.1/include/c++/12/bits/stl_construct.h:188:51: error: static assertion failed: value type is destructible
  188 |       static_assert(is_destructible<_Value_type>::value,
      |                                                   ^~~~~
/collab/usr/global/tools/tce4/packages/gcc/gcc-12.1.1/include/c++/12/bits/stl_construct.h:188:51: note: ‘std::integral_constant<bool, false>::value’ evaluates to false
/collab/usr/global/tools/tce4/packages/gcc/gcc-12.1.1/include/c++/12/bits/stl_construct.h:195:25: error: invalid use of incomplete type ‘std::iterator_traits<std::array<unsigned int, 3>*>::value_type’ {aka ‘struct std::array<unsigned int, 3>’}
  195 |       std::_Destroy_aux<__has_trivial_destructor(_Value_type)>::
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/collab/usr/global/tools/tce4/packages/gcc/gcc-12.1.1/include/c++/12/tuple:1595:45: note: declaration of ‘std::iterator_traits<std::array<unsigned int, 3>*>::value_type’ {aka ‘struct std::array<unsigned int, 3>’}
 1595 |   template<typename _Tp, size_t _Nm> struct array;
      |                                             ^~~~~
make[2]: *** [tests/CMakeFiles/testTradeGhostValues.dir/build.make:76: tests/CMakeFiles/testTradeGhostValues.dir/testTradeGhostValues.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:938: tests/CMakeFiles/testTradeGhostValues.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

dreamer2368 avatar Apr 09 '24 01:04 dreamer2368