[Bug c++/96742] "warning: comparison of unsigned expression in ‘< 0’ is always false" with dependent values
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96742 --- Comment #2 from William Throwe --- It was decided in bug 11856 that it was a bug to warn about comparisons when a choice for a type template parameter made them always false, so it seems like it should also be a bug to warn if a non-type template parameter makes them always false. More practically, the warning is basically unactionable when template arguments are involved. Here's a slightly more complex example: --- template T f(const std::array& x) { T ret = 0; for (size_t i = 0; i < N; ++i) { ret += i * x[i]; } return ret; } --- This warns if passed an array of length 0 because the for-loop condition is always false. Any change I can make to fix it seems to make the code worse. I could replace "i < N" with "i + 1 < N + 1", but that certainly doesn't make the code clearer (and in similar cases could lead to weird overflow bugs). I can't partially specialize the function, because that's not allowed. I could write an implementation struct and specialize that, but that seems like massive overkill when the generic function works fine.
[Bug c++/96742] New: "warning: comparison of unsigned expression in ‘< 0’ is always false" with dependent values
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96742 Bug ID: 96742 Summary: "warning: comparison of unsigned expression in ‘< 0’ is always false" with dependent values Product: gcc Version: 10.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: wtt6 at cornell dot edu Target Milestone: --- The following code warns "comparison of unsigned expression in ‘< 0’ is always false" when compiled with 10.2.0, but not with 10.1. --- template bool f(unsigned x) { return x < N; } int main() { f<0>(1); } --- This appears to be similar to bug 11856 and, in particular, its duplicate bug 45553.
[Bug c++/90538] New: Redeclaration error when expanding parameter pack multiple times in a lambda
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90538 Bug ID: 90538 Summary: Redeclaration error when expanding parameter pack multiple times in a lambda Product: gcc Version: 9.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: wtt6 at cornell dot edu Target Milestone: --- With gcc-9.1.0, compiling this code --- template void a(const T&...) {} template void b(const T&... t) { [&]() { a(t...); a(t...); }; } void c() { b(1); } --- gives errors --- test.cpp: In instantiation of ‘void b(const T& ...) [with T = {int}]’: test.cpp:13:6: required from here test.cpp:8:7: error: redeclaration of ‘const int& t#0’ 8 | a(t...); | ^ test.cpp:7:7: note: ‘const int& t#0’ previously declared here 7 | a(t...); | ^ test.cpp:6:3: error: member ‘b(const T& ...) [with T = {int}]’ is uninitialized reference 6 | [&]() { | ^~~ 7 | a(t...); | 8 | a(t...); | 9 | }; | ~ test.cpp:6:3: error: designator order for field ‘b(const T& ...) [with T = {int}]’ does not match declaration order in ‘b(const T& ...) [with T = {int}]::’ --- This was accepted by gcc 8.3.
[Bug c++/84813] New: internal compiler error: Segmentation fault with lambdas and constexpr variables
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84813 Bug ID: 84813 Summary: internal compiler error: Segmentation fault with lambdas and constexpr variables Product: gcc Version: 7.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: wtt6 at cornell dot edu Target Milestone: --- Host: x86_64-pc-linux-gnu Build: x86_64-pc-linux-gnu Created attachment 43619 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43619&action=edit test.cpp The attached source file causes segfaults in gcc 7.3.0 and 6.4.0 when compiling with debug symbols. (The below output is from a Gentoo system but I have verified that this occurs elsewhere as well.) $ g++-7.3.0 -v -std=c++14 -g test.cpp Using built-in specs. COLLECT_GCC=g++-7.3.0 COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/7.3.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /var/tmp/portage/sys-devel/gcc-7.3.0/work/gcc-7.3.0/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/7.3.0 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/7.3.0 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/7.3.0/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/7.3.0/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/g++-v7 --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/7.3.0/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 7.3.0 p1.0' --disable-esp --enable-libstdcxx-time --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-altivec --disable-fixed-point --enable-targets=all --disable-libgcj --enable-libgomp --disable-libmudflap --disable-libssp --disable-libcilkrts --disable-libmpx --enable-vtable-verify --enable-libvtv --enable-lto --without-isl --enable-libsanitizer --enable-default-pie --enable-default-ssp Thread model: posix gcc version 7.3.0 (Gentoo 7.3.0 p1.0) COLLECT_GCC_OPTIONS='-v' '-std=c++14' '-g' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/libexec/gcc/x86_64-pc-linux-gnu/7.3.0/cc1plus -quiet -v -D_GNU_SOURCE test.cpp -quiet -dumpbase test.cpp -mtune=generic -march=x86-64 -auxbase test -g -std=c++14 -version -o /tmp/ccwMTi4n.s GNU C++14 (Gentoo 7.3.0 p1.0) version 7.3.0 (x86_64-pc-linux-gnu) compiled by GNU C version 7.3.0, GMP version 6.1.2, MPFR version 3.1.6, MPC version 1.0.3, isl version noneGGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ignoring nonexistent directory "/usr/local/include" ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../x86_64-pc-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/g++-v7 /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/g++-v7/x86_64-pc-linux-gnu /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/g++-v7/backward /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include-fixed /usr/include End of search list. GNU C++14 (Gentoo 7.3.0 p1.0) version 7.3.0 (x86_64-pc-linux-gnu) compiled by GNU C version 7.3.0, GMP version 6.1.2, MPFR version 3.1.6, MPC version 1.0.3, isl version none GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 97a14d92d195bbf5fa3050d06d00adda g++-7.3.0: internal compiler error: Segmentation fault (program cc1plus) Please submit a full bug report, with preprocessed source if appropriate. See <https://bugs.gentoo.org/> for instructions.
[Bug other/68239] New: libbacktrace allocation is sometimes very slow
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68239 Bug ID: 68239 Summary: libbacktrace allocation is sometimes very slow Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: other Assignee: unassigned at gcc dot gnu.org Reporter: wtt6 at cornell dot edu Target Milestone: --- From https://github.com/rust-lang/rust/issues/29293 In the Rust project, we are encountering cases where libbacktrace spends about a second performing the actual work of generating a backtrace and about a minute managing its memory allocator (absolute times are machine-dependent, obviously). The problem appears to be that the linked list of freed allocations available for reuse ends up containing tens of thousands of entries that are all too small to satisfy most (all?) allocation requests, and the allocator loops over and tests all of them before deciding to mmap more memory.
[Bug c++/58983] ICE when inheriting templated constructor
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58983 --- Comment #4 from William Throwe --- Testing, I cannot reproduce either on a different machine, so probably something just went wrong with my install here. Sorry for the noise.
[Bug c++/58983] New: ICE when inheriting templated constructor
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58983 Bug ID: 58983 Summary: ICE when inheriting templated constructor Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: wtt6 at cornell dot edu $ cat foo.cpp struct Base { template Base(T) { } }; struct Derived: public Base { using Base::Base; }; int main() { Derived(1); return 0; } $ /var/tmp/portage/wthrowe-gcc-trunk/dist/bin/g++ -v -std=c++11 foo.cpp Using built-in specs. COLLECT_GCC=/var/tmp/portage/wthrowe-gcc-trunk/dist/bin/g++ COLLECT_LTO_WRAPPER=/var/tmp/portage/wthrowe-gcc-trunk/dist/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../srcdir/configure --prefix=/var/tmp/portage/wthrowe-gcc-trunk/dist Thread model: posix gcc version 4.9.0 20131103 (experimental) (GCC) COLLECT_GCC_OPTIONS='-v' '-std=c++11' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /var/tmp/portage/wthrowe-gcc-trunk/dist/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/cc1plus -quiet -v -D_GNU_SOURCE foo.cpp -quiet -dumpbase foo.cpp -mtune=generic -march=x86-64 -auxbase foo -std=c++11 -version -o /tmp/ccBubai5.s GNU C++ (GCC) version 4.9.0 20131103 (experimental) (x86_64-unknown-linux-gnu) compiled by GNU C version 4.9.0 20131103 (experimental), GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.1 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 ignoring nonexistent directory "/usr/local/include" ignoring nonexistent directory "/var/tmp/portage/wthrowe-gcc-trunk/dist/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../x86_64-unknown-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /var/tmp/portage/wthrowe-gcc-trunk/dist/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0 /var/tmp/portage/wthrowe-gcc-trunk/dist/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/x86_64-unknown-linux-gnu /var/tmp/portage/wthrowe-gcc-trunk/dist/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/backward /var/tmp/portage/wthrowe-gcc-trunk/dist/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/include /var/tmp/portage/wthrowe-gcc-trunk/dist/include /var/tmp/portage/wthrowe-gcc-trunk/dist/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/include-fixed /usr/include End of search list. GNU C++ (GCC) version 4.9.0 20131103 (experimental) (x86_64-unknown-linux-gnu) compiled by GNU C version 4.9.0 20131103 (experimental), GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.1 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: 2df0428df4df4a6a1a5fa39a6a3e09ed foo.cpp: In constructor ‘Derived::Derived(T) [with T = int]’: foo.cpp:2:43: internal compiler error: Bus error struct Derived: public Base { using Base::Base; }; ^ 0xb2d06f crash_signal ../../srcdir/gcc/toplev.c:334 0xf3dfa0 recog_97 ../../srcdir/gcc/config/i386/i386.md:941 0xdf594d recog_memoized ../../srcdir/gcc/recog.h:155 0xdf594d insn_default_length(rtx_def*) ../../srcdir/gcc/config/i386/i386.md:636 0x8e59bd shorten_branches(rtx_def*) ../../srcdir/gcc/final.c:1190 0x8e5c8f rest_of_handle_shorten_branches ../../srcdir/gcc/final.c:4516 0x8e5c8f execute ../../srcdir/gcc/final.c:4545 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions.