https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89767
Bug ID: 89767 Summary: ICE with tuple and optimization Product: gcc Version: 8.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: klystron25 at gmail dot com Target Milestone: --- Created attachment 45994 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45994&action=edit preprocessed source The following source file causes ICE when -O2 is used. This code compiles correctly with the same command line on gcc 7.3.0. This is gcc 8.3.0 running on amd64. I am runnig gentoo, but I downloaded 8.3.0 source and built it from scratch just to ensure it wasn't gentoo's patchset. I tried a simple configure with just --enable-languages=c,c++ and then this below which I'm providing the report from: Configured with: /var/tmp/portage/sys-devel/gcc-8.3.0/work/gcc-8.3.0/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/8.3.0 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/8.3.0 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/8.3.0/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/8.3.0/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/g++-v8 --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/8.3.0/python --enable-languages=c,c++ --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 8.3.0 p1.0' --disable-esp --enable-libstdcxx-time --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-altivec --disable-fixed-point --enable-targets=all --enable-libgomp --disable-libmudflap --disable-libssp --disable-libmpx --disable-systemtap --enable-vtable-verify --disable-libquadmath --enable-lto --without-isl --enable-default-pie --enable-default-ssp Thread model: posix /home/darkwing/gcc/usr/x86_64-pc-linux-gnu/gcc-bin/8.3.0/c++ -Dmsb_EXPORTS -I/home/darkwing/work/nasa/pace/opt/include/efsi -I/home/darkwing/work/efs/sts/repos/cvt/msb/libmsb/include -I/home/darkwing/work/efs/sts/repos/cvt/msb/libmsb/include/internal -fPIC -fvisibility=hidden --std=c++14 -pedantic -Wall -Wextra -Wundef -Wno-noexcept-type -save-temps -o CMakeFiles/msb.dir/src/connection/internal.cpp.o -c /home/darkwing/work/efs/sts/repos/cvt/msb/libmsb/src/connection/internal.cpp -O2 In file included from /home/darkwing/gcc/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/g++-v8/bits/hashtable_policy.h:34, from /home/darkwing/gcc/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/g++-v8/bits/hashtable.h:35, from /home/darkwing/gcc/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/g++-v8/unordered_map:46, from /home/darkwing/work/efs/sts/repos/cvt/msb/libmsb/include/internal/connection.hpp:4, from /home/darkwing/work/efs/sts/repos/cvt/msb/libmsb/src/connection/internal.cpp:1: /home/darkwing/gcc/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/g++-v8/tuple: In instantiation of ‘constexpr _Head& std::__get_helper(std::_Tuple_impl<_Idx, _Head, _Tail ...>&) [with long unsigned int __i = 1; _Head = std::shared_ptr<msb::node>; _Tail = {}]’: /home/darkwing/gcc/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/g++-v8/tuple:1315:36: required from ‘constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(std::tuple<_Elements ...>&) [with long unsigned int __i = 1; _Elements = {std::shared_ptr<msb::internal::model_support::node_subscriber>, std::shared_ptr<msb::node>}; std::__tuple_element_t<__i, std::tuple<_Elements ...> > = std::shared_ptr<msb::node>]’ /home/darkwing/work/efs/sts/repos/cvt/msb/libmsb/src/connection/internal.cpp:92:92: required from here /home/darkwing/gcc/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/g++-v8/tuple:1303:5: internal compiler error: Segmentation fault __get_helper(_Tuple_impl<__i, _Head, _Tail...>& __t) noexcept ^~~~~~~~~~~~ 0xb5688f crash_signal ../../gcc-8.3.0/gcc/toplev.c:325 0x66d25d check_local_shadow ../../gcc-8.3.0/gcc/cp/name-lookup.c:2670 0x66d25d do_pushdecl ../../gcc-8.3.0/gcc/cp/name-lookup.c:3084 0x66d25d pushdecl(tree_node*, bool) ../../gcc-8.3.0/gcc/cp/name-lookup.c:3152 0x617626 store_parm_decls ../../gcc-8.3.0/gcc/cp/decl.c:15454 0x617626 start_preparsed_function(tree_node*, tree_node*, int) ../../gcc-8.3.0/gcc/cp/decl.c:15328 0x6b84b8 instantiate_decl(tree_node*, bool, bool) ../../gcc-8.3.0/gcc/cp/pt.c:24048 0x5f26e4 cxx_eval_call_expression ../../gcc-8.3.0/gcc/cp/constexpr.c:1563 0x5f374d cxx_eval_constant_expression ../../gcc-8.3.0/gcc/cp/constexpr.c:4231 0x5f741c cxx_eval_outermost_constant_expr ../../gcc-8.3.0/gcc/cp/constexpr.c:4894 0x5f937e maybe_constant_value(tree_node*, tree_node*) ../../gcc-8.3.0/gcc/cp/constexpr.c:5112 0x603f92 cp_fold ../../gcc-8.3.0/gcc/cp/cp-gimplify.c:2521 0x6043cc cp_fold_maybe_rvalue ../../gcc-8.3.0/gcc/cp/cp-gimplify.c:2075 0x6033ca cp_fold_maybe_rvalue ../../gcc-8.3.0/gcc/cp/cp-gimplify.c:2216 0x6033ca cp_fold ../../gcc-8.3.0/gcc/cp/cp-gimplify.c:2216 0x6043cc cp_fold_maybe_rvalue ../../gcc-8.3.0/gcc/cp/cp-gimplify.c:2075 0x6033ca cp_fold_maybe_rvalue ../../gcc-8.3.0/gcc/cp/cp-gimplify.c:2216 0x6033ca cp_fold ../../gcc-8.3.0/gcc/cp/cp-gimplify.c:2216 0x6043cc cp_fold_maybe_rvalue ../../gcc-8.3.0/gcc/cp/cp-gimplify.c:2075 0x6033ca cp_fold_maybe_rvalue ../../gcc-8.3.0/gcc/cp/cp-gimplify.c:2216 Please submit a full bug report, with preprocessed source if appropriate.