From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BAB233858D35; Tue, 31 Jan 2023 20:06:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BAB233858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675195589; bh=C042+TR8SOpv/VvAidgkuR34a4kkdyfMfLQ2wcHtwE4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=s5Q2UcQh1msqWshiGssg9h6Ub96kNFpS4jwKZxu5nDt+wAuBNw7Ks1TlmqLuH0Dgl uW9hjbAq2uUjQQltO4Ej9dwTvWJjBCkDC+m57Uqb+ph0SAv3qYL/fYQMwuND8fgSFt D4oXoXi7QZuVRnqgXtCZXh/uRdSVbP2Ue5jOW76o= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/108354] [13 Regression] Dead Code Elimination Regression at -O2 since r13-89-gb3e98eb3396e16 Date: Tue, 31 Jan 2023 20:06:29 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: pinskia at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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=3D108354 --- Comment #5 from Andrew Pinski --- (In reply to Andrew Pinski from comment #4) > raised STORAGE_ERROR : stack overflow or erroneous memory access 0x00000000015769b4 in get_range_query (fun=3D) at /home/apinski/src/upstream-gcc/gcc/gcc/value-query.h:143 143 return fun->x_range_query ? fun->x_range_query : &global_ranges; (gdb) bt #0 0x00000000015769b4 in get_range_query (fun=3D) at /home/apinski/src/upstream-gcc/gcc/gcc/value-query.h:143 #1 ssa_name_has_boolean_range(tree_node*) () at /home/apinski/src/upstream-gcc/gcc/gcc/tree-ssanames.cc:534 #2 0x0000000001ae01a6 in generic_simplify_MINUS_EXPR(unsigned int, tree_co= de, tree_node*, tree_node*, tree_node*) [clone .constprop.0] () at /home/apinski/src/upstream-gcc/gcc/gcc/tree.h:3654 #3 0x0000000000fb1286 in fold_binary_loc(unsigned int, tree_code, tree_nod= e*, tree_node*, tree_node*) () at /home/apinski/src/upstream-gcc/gcc/gcc/fold-const.cc:10926 #4 0x0000000000fb8eeb in fold_build2_loc (loc=3Dloc@entry=3D0, code=3Dcode@entry=3DMINUS_EXPR, type=3D0x7ffff725c000, op0=3Dop0@entry=3D0x= 7ffff7242d50, op1=3Dop1@entry=3D0x7ffff52a6870) at /home/apinski/src/upstream-gcc/gcc/gcc/fold-const.cc:13824 #5 0x0000000000f7373f in get_inner_reference(tree_node*, poly_int_pod<1u, long>*, poly_int_pod<1u, long>*, tree_node**, machine_mode*, int*, int*, in= t*) () at /home/apinski/src/upstream-gcc/gcc/gcc/tree.h:3645 #6 0x00000000010a2546 in (anonymous namespace)::isra_analyze_call(cgraph_edge*) () at /home/apinski/src/upstream-gcc/gcc/gcc/ipa-sra.cc:2167 #7 0x00000000010a32a8 in (anonymous namespace)::isra_analyze_all_outgoing_calls (node=3D) at /home/apinski/src/upstream-gcc/gcc/gcc/ipa-sra.cc:2202 #8 ipa_sra_summarize_function(cgraph_node*) () at /home/apinski/src/upstream-gcc/gcc/gcc/ipa-sra.cc:4540 #9 0x00000000010a5558 in (anonymous namespace)::ipa_sra_generate_summary()= () at /home/apinski/src/upstream-gcc/gcc/gcc/ipa-sra.cc:2716 #10 0x0000000001242f23 in execute_ipa_summary_passes (ipa_pass=3D0x3a90670)= at /home/apinski/src/upstream-gcc/gcc/gcc/passes.cc:2297 (gdb) p cfun $3 =3D (function *) 0x0 Ok, let me mark the pattern only for GIMPLE because it looks like we are calling fold without setting cfun and still passing a SSA_NAME. I suspect we might run into this issue with other code too but at least I h= ide the latent bug ...=