From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 93BE5386F0EB; Mon, 27 Jun 2022 11:55:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 93BE5386F0EB From: "ivanka2012 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug lto/106103] New: ICE in binds_to_current_def_p when source object files are compiled with -flto -Os Date: Mon, 27 Jun 2022 11:55:49 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: lto X-Bugzilla-Version: 12.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ivanka2012 at gmail dot com 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 cc target_milestone cf_gcchost cf_gcctarget cf_gccbuild 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: Mon, 27 Jun 2022 11:55:49 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106103 Bug ID: 106103 Summary: ICE in binds_to_current_def_p when source object files are compiled with -flto -Os Product: gcc Version: 12.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: ivanka2012 at gmail dot com CC: marxin at gcc dot gnu.org Target Milestone: --- Host: x86_64-build_pc-linux-gnu Target: x86_64-w64-mingw32 Build: x86_64-build_pc-linux-gnu Created attachment 53209 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D53209&action=3Dedit Source code that contains alc.cpp.ii, buffer.cpp.ii and openal-info.c.i Compile the attached source files in the archive with the following command= s: x86_64-w64-mingw32-g++ -flto -Os -std=3Dgnu++14 -o alc.o -c alc.cpp.ii x86_64-w64-mingw32-g++ -flto -Os -std=3Dgnu++14 -o buffer.o -c buffer.cpp.ii x86_64-w64-mingw32-gcc -flto -Os -std=3Dgnu11 -o openal-info.o -c openal-in= fo.c.i x86_64-w64-mingw32-g++ -r openal-info.o buffer.o alc.o -o /dev/null -lkerne= l32 The linker will yield the following: during GIMPLE pass: dse alc.cpp.ii: In function 'alcGetString': alc.cpp.ii:1167:13: internal compiler error: in binds_to_current_def_p, at symtab.cc:2494 1167 | const char *alcGetString() try { | ^ 0x681fd1 symtab_node::binds_to_current_def_p(symtab_node*) /x/crosstool-ng/.build/x86_64-w64-mingw32/src/gcc/gcc/symtab.cc:2494 0xc5a980 ref_maybe_used_by_call_p_1 =20=20=20=20=20=20=20 /x/crosstool-ng/.build/x86_64-w64-mingw32/src/gcc/gcc/tree-ssa-alias.cc:2804 0xc5c137 ref_maybe_used_by_call_p =20=20=20=20=20=20=20 /x/crosstool-ng/.build/x86_64-w64-mingw32/src/gcc/gcc/tree-ssa-alias.cc:2929 0xc5c137 ref_maybe_used_by_stmt_p(gimple*, ao_ref*, bool) =20=20=20=20=20=20=20 /x/crosstool-ng/.build/x86_64-w64-mingw32/src/gcc/gcc/tree-ssa-alias.cc:2961 0xc7e517 dse_classify_store(ao_ref*, gimple*, bool, simple_bitmap_def*, boo= l*, tree_node*) =20=20=20=20=20=20=20 /x/crosstool-ng/.build/x86_64-w64-mingw32/src/gcc/gcc/tree-ssa-dse.cc:981 0xc7ff76 dse_optimize_stmt =20=20=20=20=20=20=20 /x/crosstool-ng/.build/x86_64-w64-mingw32/src/gcc/gcc/tree-ssa-dse.cc:1385 0xc7ff76 execute =20=20=20=20=20=20=20 /x/crosstool-ng/.build/x86_64-w64-mingw32/src/gcc/gcc/tree-ssa-dse.cc:1491 The compiler is configured with the following flags: --build=3Dx86_64-build_pc-linux-gnu --host=3Dx86_64-build_pc-linux-gnu --target=3Dx86_64-w64-mingw32 --prefix=3D/prefix --exec_prefix=3D/prefix --with-sysroot=3D/prefix/x86_64-w64-mingw32/sysroot --enable-languages=3Dc,c++,fortran --with-pkgversion=3D'crosstool-NG 1.25.0.40_994767d' --disable-shared --enable-__cxa_atexit --disable-libmudf= lap --disable-libgomp --disable-libssp --disable-libquadmath --disable-libquadmath-support --disable-libsanitizer --disable-libmpx --disable-libstdcxx-verbose --with-gmp=3D/x/crosstool-ng/.build/x86_64-w64-mingw32/buildtools --with-mpfr=3D/x/crosstool-ng/.build/x86_64-w64-mingw32/buildtools --with-mpc=3D/x/crosstool-ng/.build/x86_64-w64-mingw32/buildtools --with-isl=3D/x/crosstool-ng/.build/x86_64-w64-mingw32/buildtools --enable-= lto --enable-threads=3Dposix --enable-target-optspace --enable-plugin --disable= -nls --enable-multiarch --with-local-prefix=3D/prefix/x86_64-w64-mingw32/sysroot --enable-long-long However, this was supplied by crosstool-ng, which I used to compile the toolchain. You might need to use that instead. The toolchain can be compiled with crosstool-ng using the following: ./ct-ng x86_64-w64-mingw32 ./ct-ng build I also set the prefix to something more reasonable and all compiler and lin= ker flags were set to be '-g' but nothing else. Notes: This is already the most minimal possible test case. I tried fiddling with = the compiler and linker flags and the above combination is the most minimal one that produces the ICE. The source code has also been processed with cvise f= or several days. I also observed this ICE in the "alias" GIMPLE pass in other test cases that are not included here since I haven't reduced those.=