This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/67561] New: [C++14] ICE in tsubst_copy (nested auto lambdas may be involved)
- From: "bisqwit at iki dot fi" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 12 Sep 2015 20:46:27 +0000
- Subject: [Bug c++/67561] New: [C++14] ICE in tsubst_copy (nested auto lambdas may be involved)
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67561
Bug ID: 67561
Summary: [C++14] ICE in tsubst_copy (nested auto lambdas may be
involved)
Product: gcc
Version: 5.2.1
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: bisqwit at iki dot fi
Target Milestone: ---
When compiling this program,
struct Polygon {};
template<typename PixType>
struct View {};
template<typename PixType, typename... Params>
void RenderLight(PixType, Params&&... pack)
{
View<PixType> tmp;
DrawView(pack..., tmp);
}
template<typename Plotter>
static void DrawPolygon(Plotter plot_pixel)
{
plot_pixel(1,1,1, [&](unsigned n) { return n; });
}
template<typename View, typename PlotFunc>
static void DrawView(PlotFunc&& GetPlotFunc,
View& view)
{
DrawPolygon(GetPlotFunc(view, Polygon{}, false));
}
static auto LightmapRenderer = [](unsigned round)
{
return [round](auto& view, const Polygon& polygon, bool)
{
return [=,&view,&polygon](unsigned x,unsigned y, float z, auto&&
prop)
{
if(true) { if(round == 1) {} }
else { if(round > 1) {} }
};
};
};
void CalculateLightmap()
{
RenderLight( 0, LightmapRenderer(1) );
}
The following error is produced:
testv.cc: In instantiation of '<lambda(unsigned int)>::<lambda(auto:1&,
const Polygon&, bool)>::<lambda(unsigned int, unsigned int, float, auto:2&&)>
[with auto:2 = DrawPolygon(Plotter) [with Plotter = <lambda(unsigned
int)>::<lambda(auto:1&, const Polygon&, bool)> [with auto:1 =
View<int>]::<lambda(unsigned int, unsigned int, float,
auto:2&&)>]::<lambda(unsigned int)>; auto:1 = View<int>]':
testv.cc:16:15: required from 'void DrawPolygon(Plotter) [with Plotter =
<lambda(unsigned int)>::<lambda(auto:1&, const Polygon&, bool)> [with auto:1 =
View<int>]::<lambda(unsigned int, unsigned int, float, auto:2&&)>]'
testv.cc:23:16: required from 'void DrawView(PlotFunc&&, View&) [with
View = View<int>; PlotFunc = <lambda(unsigned int)>::<lambda(auto:1&, const
Polygon&, bool)>&]'
testv.cc:10:13: required from 'void RenderLight(PixType, Params&& ...)
[with PixType = int; Params = {<lambda(unsigned int)>::<lambda(auto:1&, const
Polygon&, bool)>}]'
testv.cc:40:41: required from here
testv.cc:29:5: internal compiler error: in tsubst_copy, at cp/pt.c:12997
{
^
0x632bbe tsubst_copy
../../src/gcc/cp/pt.c:12997
0x623a08 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*,
bool, bool)
../../src/gcc/cp/pt.c:15740
0x6246c8 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*,
bool, bool)
../../src/gcc/cp/pt.c:14771
0x6242d1 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*,
bool, bool)
../../src/gcc/cp/pt.c:15522
0x62c002 tsubst_expr
../../src/gcc/cp/pt.c:14552
0x63492d tsubst_decl
../../src/gcc/cp/pt.c:11500
0x632a7a tsubst_copy
../../src/gcc/cp/pt.c:13127
0x623a08 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*,
bool, bool)
../../src/gcc/cp/pt.c:15740
0x624ae7 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*,
bool, bool)
../../src/gcc/cp/pt.c:14930
0x62c002 tsubst_expr
../../src/gcc/cp/pt.c:14552
0x62b3c5 tsubst_expr
../../src/gcc/cp/pt.c:14113
0x62bf4c tsubst_expr
../../src/gcc/cp/pt.c:14135
0x62b3e5 tsubst_expr
../../src/gcc/cp/pt.c:14115
0x62bf4c tsubst_expr
../../src/gcc/cp/pt.c:14135
0x62b8f4 tsubst_expr
../../src/gcc/cp/pt.c:13949
0x62bf4c tsubst_expr
../../src/gcc/cp/pt.c:14135
0x62acb7 instantiate_decl(tree_node*, int, bool)
../../src/gcc/cp/pt.c:20582
0x659f62 mark_used(tree_node*, int)
../../src/gcc/cp/decl2.c:5035
0x5f9800 build_over_call
../../src/gcc/cp/call.c:7501
0x5fbf31 build_op_call_1
../../src/gcc/cp/call.c:4345
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-5/README.Bugs> for instructions.
Compiler version 5.2.1, on Debian x86_64. More information (g++ -v):
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 5.2.1-16'
--with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs
--enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-5 --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-5-amd64/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --with-arch-32=i586 --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 5.2.1 20150903 (Debian 5.2.1-16)
COLLECT_GCC_OPTIONS='-v' '-Wall' '-Wextra' '-std=c++14' '-O0'
'-shared-libgcc' '-mtune=generic' '-march=x86-64'
/usr/lib/gcc/x86_64-linux-gnu/5/cc1plus -quiet -v -imultiarch
x86_64-linux-gnu -D_GNU_SOURCE testv.cc -quiet -dumpbase testv.cc
-mtune=generic -march=x86-64 -auxbase testv -O0 -Wall -Wextra -std=c++14
-version -o /tmp/cc99eXwV.s
GNU C++14 (Debian 5.2.1-16) version 5.2.1 20150903 (x86_64-linux-gnu)
compiled by GNU C version 5.2.1 20150903, GMP version 6.0.0, MPFR
version 3.1.3, MPC version 1.0.3
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/5"
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-linux-gnu/5/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/include/c++/5
/usr/include/x86_64-linux-gnu/c++/5
/usr/include/c++/5/backward
/usr/lib/gcc/x86_64-linux-gnu/5/include
/usr/local/include
/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
GNU C++14 (Debian 5.2.1-16) version 5.2.1 20150903 (x86_64-linux-gnu)
compiled by GNU C version 5.2.1 20150903, GMP version 6.0.0, MPFR
version 3.1.3, MPC version 1.0.3
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 8c90e1ad7f61e19a950a98d7345debd3
Occurs on all optimization levels through -O0 and -Ofast.
Does not occur in GCC 4.9. Unfortunately I don't have a copy of GCC 5.1 to test
with. Looks like Debian replaced 5.1 with 5.2 and doesn't give an opportunity
for them to coexist.