From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5FAF138618AB; Thu, 21 Dec 2023 07:07:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5FAF138618AB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1703142444; bh=DMNKMpZDhqtzDz7Lvv14pARdJ63WtuQNx57JTiB4ZHM=; h=From:To:Subject:Date:From; b=xXyMJdf8n4LOCjMe/O0H//oawF4Nbx/yaKmd3jRRA5fy5tGleBlvQfTo7EM0lLfoF dk+dy/V54XNd/gVHtphA2o3pEQdQYtESApU+VNRJtjDrUS6zFyZuMXke3L3aIVd7co gDonWNUQaLgRADkUNTcDA9PYFHd68jefETba8C34= From: "zsojka at seznam dot cz" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/113102] New: during GIMPLE pass: bitintlower ICE: SIGSEGV with _BitInt() at -O1 or -O2 Date: Thu, 21 Dec 2023 07:07:21 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: zsojka at seznam dot cz 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 keywords bug_severity priority component assigned_to reporter cc target_milestone cf_gcchost cf_gcctarget 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113102 Bug ID: 113102 Summary: during GIMPLE pass: bitintlower ICE: SIGSEGV with _BitInt() at -O1 or -O2 Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: zsojka at seznam dot cz CC: jakub at gcc dot gnu.org Target Milestone: --- Host: x86_64-pc-linux-gnu Target: x86_64-pc-linux-gnu Created attachment 56913 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D56913&action=3Dedit reduced testcase Thank you for the fixes so far. I am observing SIGSEGV at various places at -O1 and -O2, when using _BitInt= (). This happens also with the PR112941#c8 patch applied. Compiler output: $ x86_64-pc-linux-gnu-gcc -O testcase-O1.c -wrapper valgrind,-q testcase-O1.c: In function 'foo2': testcase-O1.c:24:17: warning: division by zero [-Wdiv-by-zero] 24 | bi8 /=3D x >> 0 / 0; | ^ =3D=3D16226=3D=3D Invalid read of size 2 =3D=3D16226=3D=3D at 0x261843D: (anonymous namespace)::bitint_large_huge::add_cast(tree_node*, tree_node*) (gimple-lower-bitint.cc:1052) =3D=3D16226=3D=3D by 0x2621F90: (anonymous namespace)::bitint_large_huge::handle_cast(tree_node*, tree_node*, tree_nod= e*) (gimple-lower-bitint.cc:1501) =3D=3D16226=3D=3D by 0x261F200: (anonymous namespace)::bitint_large_huge::handle_operand(tree_node*, tree_node*) (gimple-lower-bitint.cc:790) =3D=3D16226=3D=3D by 0x262E269: (anonymous namespace)::bitint_large_huge::lower_shift_stmt(tree_node*, gimple*) (gimple-lower-bitint.cc:3137) =3D=3D16226=3D=3D by 0x2631849: gimple_lower_bitint() (gimple-lower-biti= nt.cc:6469) =3D=3D16226=3D=3D by 0x13C4D6A: execute_one_pass(opt_pass*) (passes.cc:2= 646) =3D=3D16226=3D=3D by 0x13C565F: execute_pass_list_1(opt_pass*) (passes.c= c:2755) =3D=3D16226=3D=3D by 0x13C5671: execute_pass_list_1(opt_pass*) (passes.c= c:2756) =3D=3D16226=3D=3D by 0x13C5698: execute_pass_list(function*, opt_pass*) (passes.cc:2766) =3D=3D16226=3D=3D by 0xFC6085: expand (cgraphunit.cc:1842) =3D=3D16226=3D=3D by 0xFC6085: cgraph_node::expand() (cgraphunit.cc:1795) =3D=3D16226=3D=3D by 0xFC73CA: expand_all_functions (cgraphunit.cc:2025) =3D=3D16226=3D=3D by 0xFC73CA: symbol_table::compile() [clone .part.0] (cgraphunit.cc:2399) =3D=3D16226=3D=3D by 0xFC9F47: compile (cgraphunit.cc:2312) =3D=3D16226=3D=3D by 0xFC9F47: symbol_table::finalize_compilation_unit() (cgraphunit.cc:2584) =3D=3D16226=3D=3D Address 0x0 is not stack'd, malloc'd or (recently) free'd =3D=3D16226=3D=3D=20 during GIMPLE pass: bitintlower testcase-O1.c: In function 'foo0': testcase-O1.c:9:1: internal compiler error: Segmentation fault 9 | foo0(void) | ^~~~ 0x150673f crash_signal /repo/gcc-trunk/gcc/toplev.cc:316 0x261843d add_cast /repo/gcc-trunk/gcc/gimple-lower-bitint.cc:1052 0x2621f90 handle_cast /repo/gcc-trunk/gcc/gimple-lower-bitint.cc:1501 0x261f200 handle_operand /repo/gcc-trunk/gcc/gimple-lower-bitint.cc:790 0x262e269 lower_shift_stmt /repo/gcc-trunk/gcc/gimple-lower-bitint.cc:3137 0x2631849 gimple_lower_bitint /repo/gcc-trunk/gcc/gimple-lower-bitint.cc:6469 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See for instructions. $ x86_64-pc-linux-gnu-gcc -v Using built-in specs. COLLECT_GCC=3D/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-g= cc COLLECT_LTO_WRAPPER=3D/repo/gcc-trunk/binary-trunk-r14-6769-20231221032123-= g514ea1df444-checking-yes-rtl-df-extra-nobootstrap-pr112941-mul-amd64/bin/.= ./libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /repo/gcc-trunk//configure --enable-languages=3Dc,c++ --enable-valgrind-annotations --disable-nls --enable-checking=3Dyes,rtl,df,= extra --disable-bootstrap --with-cloog --with-ppl --with-isl --build=3Dx86_64-pc-linux-gnu --host=3Dx86_64-pc-linux-gnu --target=3Dx86_64-pc-linux-gnu --with-ld=3D/usr/bin/x86_64-pc-linux-gnu-ld --with-as=3D/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch --prefix=3D/repo/gcc-trunk//binary-trunk-r14-6769-20231221032123-g514ea1df4= 44-checking-yes-rtl-df-extra-nobootstrap-pr112941-mul-amd64 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 14.0.0 20231221 (experimental) (GCC)=