Bug#886885: gcc-snapshot: "internal compiler error" for invalid input
Package: gcc-snapshot
Version: 20180107-1
Severity: normal
Dear Maintainer,
I should have reported this upstream, but creating an account on GCC Bugzilla
takes a day. In the meantime...
This sample C++ program
$ cat broken.cc
struct Rect {
int width;
};
void f() {
const Rect rect = {11}; // This should be constexpr
char str[1][rect.width+1] = {
{"12345678901"},
};
}
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.
-- System Information:
Debian Release: buster/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 4.14.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8), LANGUAGE=en_IE:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages gcc-snapshot depends on:
ii binutils 2.29.1-12
ii lib32z1 1:1.2.8.dfsg-5
ii libc6 2.25-5
ii libc6-dev 2.25-5
ii libc6-dev-i386 2.25-5
ii libc6-dev-x32 2.25-5
ii libc6-i386 2.25-5
ii libc6-x32 2.25-5
ii libgc1c2 1:7.4.2-8
ii libgmp10 2:6.1.2+dfsg-1.1
ii libisl15 0.18-1
ii libmpc3 1.0.3-2
ii libmpfr4 3.1.6-1
ii python 2.7.14-4
ii zlib1g 1:1.2.8.dfsg-5
gcc-snapshot recommends no packages.
Versions of packages gcc-snapshot suggests:
ii binutils [binutils-gold] 2.29.1-12
-- no debconf information
Reply to: