This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/65966] New: "sorry, unimplemented: unexpected AST of kind try_block" when initializing a 2D array
- From: "lhyatt at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 01 May 2015 15:33:06 +0000
- Subject: [Bug c++/65966] New: "sorry, unimplemented: unexpected AST of kind try_block" when initializing a 2D array
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65966
Bug ID: 65966
Summary: "sorry, unimplemented: unexpected AST of kind
try_block" when initializing a 2D array
Product: gcc
Version: 5.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: lhyatt at gmail dot com
Target Milestone: ---
This fails to compile with gcc 5.1, is fine with 4.9:
========
struct A {
A();
~A();
};
struct B {
A a{};
};
struct C {
B array[100][100];
} c;
=========
$ g++ -v -c -std=c++14 t.cpp
Using built-in specs.
COLLECT_GCC=g++
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-5.1.0/configure --prefix=/usr/local/gcc-5.1.0
--with-tune=westmere --with-arch=nehalem
Thread model: posix
gcc version 5.1.0 (GCC)
COLLECT_GCC_OPTIONS='-v' '-c' '-std=c++14' '-shared-libgcc' '-mtune=westmere'
'-march=nehalem'
/usr/local/gcc-5.1.0/libexec/gcc/x86_64-unknown-linux-gnu/5.1.0/cc1plus -quiet
-v -D_GNU_SOURCE t.cpp -quiet -dumpbase t.cpp -mtune=westmere -march=nehalem
-auxbase t -std=c++14 -version -o /tmp/ccmhY1ZH.s
GNU C++14 (GCC) version 5.1.0 (x86_64-unknown-linux-gnu)
compiled by GNU C version 5.1.0, GMP version 4.3.2, MPFR version
2.4.2-p1, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory
"/usr/local/gcc-5.1.0/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../x86_64-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/gcc-5.1.0/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../include/c++/5.1.0
/usr/local/gcc-5.1.0/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../include/c++/5.1.0/x86_64-unknown-linux-gnu
/usr/local/gcc-5.1.0/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../include/c++/5.1.0/backward
/usr/local/gcc-5.1.0/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/include
/usr/local/include
/usr/local/gcc-5.1.0/include
/usr/local/gcc-5.1.0/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/include-fixed
/usr/include
End of search list.
GNU C++14 (GCC) version 5.1.0 (x86_64-unknown-linux-gnu)
compiled by GNU C version 5.1.0, GMP version 4.3.2, MPFR version
2.4.2-p1, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 2a9de20833bb0c7b695acd3b2e90df62
t.cpp: In constructor 'constexpr C::C()':
t.cpp:10:8: sorry, unimplemented: unexpected AST of kind try_block
struct C {
^
t.cpp:10: confused by earlier errors, bailing out
Generally all the features in the testcase must be present (need a 2d array,
not 1d; need to explicitly put the constructor + destructor for class A; need
class B to have the NSDMI for its "a" subobject) for the error to occur.
If I make the following small change to explicitly initialize the array in
class C:
========
struct A {
A();
~A();
};
struct B {
A a{};
};
struct C {
B array[100][100] = {};
} c;
=========
then it compiles OK. However, in this case there seems to be some sort of other
issue, instead of a loop, it outputs 10000 individual instructions to
initialize the array:
.LEHB0:
call _ZN1AC1Ev
.LEHE0:
leaq 1(%rbx), %rax
movq %rax, %rdi
.LEHB1:
call _ZN1AC1Ev
.LEHE1:
leaq 2(%rbx), %rax
movq %rax, %rdi
.LEHB2:
call _ZN1AC1Ev
.LEHE2:
leaq 3(%rbx), %rax
movq %rax, %rdi
.LEHB3:
call _ZN1AC1Ev
.LEHE3:
leaq 4(%rbx), %rax
movq %rax, %rdi
... etc 10000 times.
We have a use case where we have a 100x100x100 3d array, and the compiler
spends hours generating these 1 millions instructions, whereas gcc 4.9 just
generated a reasonable loop right away.
Thank you...
-Lewis