From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 673CA3858D1E; Fri, 29 Apr 2022 05:27:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 673CA3858D1E From: "zsojka at seznam dot cz" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/105431] New: ICE: SIGSEGV in powi_as_mults_1 (tree-ssa-math-opts.cc:1512) with -Ofast and __builtin_pow() Date: Fri, 29 Apr 2022 05:27:14 +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: 13.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 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 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, 29 Apr 2022 05:27:14 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105431 Bug ID: 105431 Summary: ICE: SIGSEGV in powi_as_mults_1 (tree-ssa-math-opts.cc:1512) with -Ofast and __builtin_pow() Product: gcc Version: 13.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 Target Milestone: --- Host: x86_64-pc-linux-gnu Target: x86_64-pc-linux-gnu Created attachment 52903 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D52903&action=3Dedit reduced testcase This might be related to PR105368; on 11-branch and older, the other PR is triggered. The failing address is also very similar to the other PR. This fails for me only with a bootstrapped compiler; there might be another= UB that is exploited only when bootstrapping. $ x86_64-pc-linux-gnu-gcc -Ofast testcase.c -wrapper valgrind,-q =3D=3D24694=3D=3D Invalid read of size 1 =3D=3D24694=3D=3D at 0x158683D: powi_as_mults_1(gimple_stmt_iterator*, u= nsigned int, tree_node*, long, tree_node**) (tree-ssa-math-opts.cc:1512) =3D=3D24694=3D=3D by 0x158B56E: powi_as_mults(gimple_stmt_iterator*, uns= igned int, tree_node*, long) (tree-ssa-math-opts.cc:1551) =3D=3D24694=3D=3D by 0x158C8B1: gimple_expand_builtin_pow(gimple_stmt_it= erator*, unsigned int, tree_node*, tree_node*) (tree-ssa-math-opts.cc:2049) =3D=3D24694=3D=3D by 0x158CF59: (anonymous namespace)::pass_cse_sincos::execute(function*) (tree-ssa-math-opts.cc:2317) =3D=3D24694=3D=3D by 0x12EB49A: execute_one_pass(opt_pass*) (passes.cc:2= 638) =3D=3D24694=3D=3D by 0x12EBD5F: execute_pass_list_1(opt_pass*) (passes.c= c:2738) =3D=3D24694=3D=3D by 0x12EBD71: execute_pass_list_1(opt_pass*) (passes.c= c:2739) =3D=3D24694=3D=3D by 0x12EBD98: execute_pass_list(function*, opt_pass*) (passes.cc:2749) =3D=3D24694=3D=3D by 0xF15F75: expand (cgraphunit.cc:1835) =3D=3D24694=3D=3D by 0xF15F75: cgraph_node::expand() (cgraphunit.cc:1788) =3D=3D24694=3D=3D by 0xF17536: expand_all_functions (cgraphunit.cc:1999) =3D=3D24694=3D=3D by 0xF17536: symbol_table::compile() [clone .part.0] (cgraphunit.cc:2349) =3D=3D24694=3D=3D by 0xF1A117: compile (cgraphunit.cc:2262) =3D=3D24694=3D=3D by 0xF1A117: symbol_table::finalize_compilation_unit() (cgraphunit.cc:2530) =3D=3D24694=3D=3D by 0x13F3E1F: compile_file() (toplev.cc:479) =3D=3D24694=3D=3D Address 0x80000000028ce240 is not stack'd, malloc'd or (= recently) free'd =3D=3D24694=3D=3D=20 during GIMPLE pass: sincos testcase.c: In function 'foo': testcase.c:2:1: internal compiler error: Segmentation fault 2 | foo (int i) | ^~~ 0x13f3b5f crash_signal /repo/gcc-trunk/gcc/toplev.cc:322 0x158683d powi_as_mults_1 /repo/gcc-trunk/gcc/tree-ssa-math-opts.cc:1512 0x158b56e powi_as_mults(gimple_stmt_iterator*, unsigned int, tree_node*, lo= ng) /repo/gcc-trunk/gcc/tree-ssa-math-opts.cc:1551 0x158c8b1 gimple_expand_builtin_pow /repo/gcc-trunk/gcc/tree-ssa-math-opts.cc:2049 0x158cf59 execute /repo/gcc-trunk/gcc/tree-ssa-math-opts.cc:2317 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-trunk-r13-21-20220428204650-g9ae8b993c= d3-checking-yes-rtl-df-extra-amd64/bin/x86_64-pc-linux-gnu-gcc COLLECT_LTO_WRAPPER=3D/repo/gcc-trunk/binary-trunk-r13-21-20220428204650-g9= ae8b993cd3-checking-yes-rtl-df-extra-amd64/bin/../libexec/gcc/x86_64-pc-lin= ux-gnu/13.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 --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-r13-21-20220428204650-g9ae8b993cd3= -checking-yes-rtl-df-extra-amd64 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 13.0.0 20220428 (experimental) (GCC)=