[Bug c++/72845] New: gcc crashes (ICE) when compiling program with complex noexcept declaration
beck.ct at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Aug 8 19:31:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72845
Bug ID: 72845
Summary: gcc crashes (ICE) when compiling program with complex
noexcept declaration
Product: gcc
Version: 6.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: beck.ct at gmail dot com
Target Milestone: ---
Created attachment 39083
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39083&action=edit
variant.cpp compiling at C++11 causes ICE in versions 5+ of gcc that I tested
* Exact version of gcc:
I reproduced this bug against
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.1)
and
gcc version 6.1.1 20160510 (Ubuntu 6.1.1-2ubuntu12~16.04)
I don't get an ICE with gcc 4.9.
* System type is Ubuntu linux:
DISTRIB_DESCRIPTION="Ubuntu 16.04.1 LTS"
* Configuration options used to build gcc:
My `gcc-6 -v` reports this:
$ gcc-6 -v
Using built-in specs.
COLLECT_GCC=gcc-6
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/6/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
6.1.1-2ubuntu12~16.04' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs
--enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-6 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib
--disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-amd64/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 6.1.1 20160510 (Ubuntu 6.1.1-2ubuntu12~16.04)
* Complete command line that triggers the crash:
$(CXX) -std=c++11 variant.cpp
* the compiler output (error messages, warnings, etc.):
$ gcc-5 -std=c++11 variant.cpp
variant.cpp: In instantiation of ‘template<class Visitor, class Visitable>
decltype
(declval<Visitable>().get_visitor_dispatch()(declval<Visitable>().which(),
forward<Visitable>(declval<Visitable>()).storage(),
forward<Visitor>(declval<Visitor>()))) strict_variant::apply_visitor(Visitor&&,
Visitable&&)’:
variant.cpp:578:15: required from ‘class strict_variant::variant<int, float>’
variant.cpp:637:89: required from here
variant.cpp:578:15: internal compiler error: in push_access_scope, at
cp/pt.c:232
friend auto apply_visitor(Visitor &&, Visitable &&)
noexcept(APPLY_VISITOR_UNEVALUATED_EXPR)
^
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.
$ gcc-6 -std=c++11 variant.cpp
variant.cpp: In instantiation of ‘template<class Visitor, class Visitable>
decltype
(declval<Visitable>().get_visitor_dispatch()(declval<Visitable>().which(),
forward<Visitable>(declval<Visitable>()).storage(),
forward<Visitor>(declval<Visitor>()))) strict_variant::apply_visitor(Visitor&&,
Visitable&&)’:
variant.cpp:578:15: required from ‘class strict_variant::variant<int, float>’
variant.cpp:637:89: required from here
variant.cpp:578:15: internal compiler error: in push_access_scope, at
cp/pt.c:229
friend auto apply_visitor(Visitor &&, Visitable &&)
noexcept(APPLY_VISITOR_UNEVALUATED_EXPR)
^~~~~~~~~~~~~
0x5fb0bb push_access_scope
../../src/gcc/cp/pt.c:228
0x62122f maybe_instantiate_noexcept(tree_node*)
../../src/gcc/cp/pt.c:21603
0x5dce98 check_redeclaration_exception_specification
../../src/gcc/cp/decl.c:1221
0x5eb12d duplicate_decls(tree_node*, tree_node*, bool)
../../src/gcc/cp/decl.c:2022
0x6e020f push_overloaded_decl_1
../../src/gcc/cp/name-lookup.c:2396
0x6e020f push_overloaded_decl
../../src/gcc/cp/name-lookup.c:2491
0x6e2d12 pushdecl_maybe_friend_1
../../src/gcc/cp/name-lookup.c:915
0x6e2d12 pushdecl_maybe_friend(tree_node*, bool)
../../src/gcc/cp/name-lookup.c:1298
0x6e3e43 pushdecl_with_scope_1
../../src/gcc/cp/name-lookup.c:2295
0x6e3f2c pushdecl_with_scope(tree_node*, cp_binding_level*, bool)
../../src/gcc/cp/name-lookup.c:2309
0x6e3fa8 pushdecl_namespace_level(tree_node*, bool)
../../src/gcc/cp/name-lookup.c:3915
0x6223ae tsubst_friend_function
../../src/gcc/cp/pt.c:9265
0x6223ae instantiate_class_template_1
../../src/gcc/cp/pt.c:10261
0x6223ae instantiate_class_template(tree_node*)
../../src/gcc/cp/pt.c:10360
0x6813ad complete_type(tree_node*)
../../src/gcc/cp/typeck.c:131
0x6e138e arg_assoc_class_only
../../src/gcc/cp/name-lookup.c:5419
0x6e14aa arg_assoc_class_only
../../src/gcc/cp/name-lookup.c:5412
0x6e14aa arg_assoc_bases
../../src/gcc/cp/name-lookup.c:5452
0x6e1a06 arg_assoc_class
../../src/gcc/cp/name-lookup.c:5505
0x6e1a06 arg_assoc_type
../../src/gcc/cp/name-lookup.c:5557
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-6/README.Bugs> for instructions.
* The complete preprocessed source:
I reduced it to the following (please find attached). Still 500 lines, sorry,
but self-contained.
This also triggers on ICE on all versions of clang that I tested,
however for clang it seems to be a parser error, and removing the outer
namespace fixes the ICE. So I stopped trying to reduce after that.
More information about the Gcc-bugs
mailing list