https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83808
Bug ID: 83808
Summary: "internal compiler error" for invalid input
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: dibbex at gmail dot com
Target Milestone: ---
Created attachment 43111
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43111&action=edit
Small test case
The attached sample C++ program fails compilation with this error:
$ /usr/lib/gcc-snapshot/bin/g++ -std=c++17 -c broken.cc
broken.cc: In function 'void f()':
broken.cc:9:3: internal compiler error: in process_init_constructor_array, at
cp/typeck2.c:1318
};
^
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-snapshot/README.Bugs> for instructions.
If I've understood the standard correctly, the expression used as the size of
the array should be a constexpr, and the compiler should complain about it.
Asking the user to file a bug report instead of fixing their code is the wrong
response.
$ /usr/lib/gcc-snapshot/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/usr/lib/gcc-snapshot/bin/g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc-snapshot/libexec/gcc/x86_64-linux-gnu/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 20180107-1'
--with-bugurl=file:///usr/share/doc/gcc-snapshot/README.Bugs
--enable-languages=c,ada,c++,go,brig,fortran,objc,obj-c++
--prefix=/usr/lib/gcc-snapshot --with-gcc-major-version-only --program-prefix=
--enable-shared --enable-linker-build-id --disable-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
--enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib
--with-tune=generic --enable-offload-targets=nvptx-none --enable-checking=yes
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 8.0.0 20180107 (experimental) [trunk revision 256322] (Debian
20180107-1)
I know that this comes from a Debian release, but the code is 100% the same
(the code itself is not patched). I've found the same error in version 7.2.0.
Version 6.4.0 instead accepts the code without complaining.