From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 140153858412; Fri, 15 Oct 2021 01:43:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 140153858412 From: "sam at gentoo dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/102757] New: ICE on amd64 (internal compiler error: in expand_expr_real_1, at expr.c:10014) Date: Fri, 15 Oct 2021 01:43:49 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 9.4.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: sam at gentoo dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Oct 2021 01:43:50 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102757 Bug ID: 102757 Summary: ICE on amd64 (internal compiler error: in expand_expr_real_1, at expr.c:10014) Product: gcc Version: 9.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: sam at gentoo dot org Target Milestone: --- Created attachment 51605 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D51605&action=3Dedit logging.ii (minimised reproducer) Originally reported downstream at https://bugs.gentoo.org/806094. I hit the issue when building android-tools-31.0.0_p1. Note that this issue does not seem to occur with gcc 10.3.0 or gcc 11.2.0. I've managed to minimise the crasher to: ``` $ cat logging.ii struct Trans_NS___cxx11_basic_string { int *c_str(); }; int snprintf(...); enum LogSeverity {}; enum LogId {}; template void SplitByLogdChunks(LogId, LogSeverity, char *, char *, int, char *msg, = F) { long max_size; Trans_NS___cxx11_basic_string file_header; char logd_chunk[max_size]; auto write_to_logd_chunk =3D [&](char *, int) { *file_header.c_str() =3D snprintf(sizeof(logd_chunk)); }; char newline; write_to_logd_chunk(msg, newline); } void LogdLogChunk(); LogId LogdLogger_id; LogSeverity LogdLogger_severity; char LogdLogger_tag, LogdLogger_file, LogdLogger_message; int LogdLogger_line; void LogdLogger() { SplitByLogdChunks(LogdLogger_id, LogdLogger_severity, &LogdLogger_tag, &LogdLogger_file, LogdLogger_line, &LogdLogger_message, LogdLogChunk); } ``` It can be induced via: ``` $ x86_64-pc-linux-gnu-g++ logging.ii during RTL pass: expand logging.ii: In lambda function: logging.ii:13:36: internal compiler error: in expand_expr_real_1, at expr.c:10014 13 | *file_header.c_str() =3D snprintf(sizeof(logd_chunk)); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~ unrecognized DWARF version in .debug_info at 6 unrecognized DWARF version in .debug_info at 6 unrecognized DWARF version in .debug_info at 6 unrecognized DWARF version in .debug_info at 6 Please submit a full bug report, with preprocessed source if appropriate. See for instructions. ``` ``` $ x86_64-pc-linux-gnu-g++ -v Using built-in specs. COLLECT_GCC=3Dx86_64-pc-linux-gnu-g++ COLLECT_LTO_WRAPPER=3D/usr/libexec/gcc/x86_64-pc-linux-gnu/9.4.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /var/tmp/portage/sys-devel/gcc-9.4.0/work/gcc-9.4.0/config= ure --host=3Dx86_64-pc-linux-gnu --build=3Dx86_64-pc-linux-gnu --prefix=3D/usr --bindir=3D/usr/x86_64-pc-linux-gnu/gcc-bin/9.4.0 --includedir=3D/usr/lib/gcc/x86_64-pc-linux-gnu/9.4.0/include --datadir=3D/usr/share/gcc-data/x86_64-pc-linux-gnu/9.4.0 --mandir=3D/usr/share/gcc-data/x86_64-pc-linux-gnu/9.4.0/man --infodir=3D/usr/share/gcc-data/x86_64-pc-linux-gnu/9.4.0/info --with-gxx-include-dir=3D/usr/lib/gcc/x86_64-pc-linux-gnu/9.4.0/include/g++= -v9 --with-python-dir=3D/share/gcc-data/x86_64-pc-linux-gnu/9.4.0/python --enable-languages=3Dc,c++,jit,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --disable-libunwind-exceptions --enable-checking=3Drelease --with-bugurl=3Dhttps://bugs.gentoo.org/ --with-pkgversion=3D'Gentoo Harden= ed 9.4.0 p1' --enable-esp --enable-libstdcxx-time --enable-host-shared --enable-shar= ed --enable-threads=3Dposix --enable-__cxa_atexit --enable-clocale=3Dgnu --enable-multilib --with-multilib-list=3Dm32,m64 --disable-fixed-point --enable-targets=3Dall --enable-libgomp --disable-libssp --disable-libada --disable-systemtap --disable-vtable-verify --disable-libvtv --enable-lto --with-isl --disable-isl-version-check --enable-default-pie --enable-default-ssp Thread model: posix gcc version 9.4.0 (Gentoo Hardened 9.4.0 p1) ```=