From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3BBB03857354; Tue, 17 May 2022 09:08:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3BBB03857354 From: "linkw at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/105459] [12/13 Regression] ICE: Segmentation fault (in record_operand_costs) since r12-3721-g63c6446f77b9001d Date: Tue, 17 May 2022 09:08:43 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: linkw at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: linkw at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.2 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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 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: Tue, 17 May 2022 09:08:44 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105459 Kewen Lin changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #6 from Kewen Lin --- The r12-3721 makes it get the exact fp_expression info and more optimization chance then exposes this issue. Some diff from a.wpa.085i.inline between the good and bad: -IPA function summary for bar/2 inlinable +IPA function summary for bar/2 inlinable fp_expression +Copying FP flags from bar/2 to foo/3 ... +Copying FP flags from foo/3 to main/5 ... -IPA function summary for main/5 inlinable +IPA function summary for main/5 inlinable fp_expression When we are expand node for function main, we create the target global for = its target option node, later init_function_start -> initialize_rtl -> backend_init_target -> ira_init -> ira_init_costs initialize the init_cost. Then it comes to handle ipa_transforms like: if (ipa_transforms_to_apply.exists ()) execute_all_ipa_transforms (false); try to call input_function for callees. In this case, function quux share t= he same target option node with main, when switching back to main, it hits the condition in=20 else if (flag_unsafe_math_optimizations !=3D TREE_TARGET_OPTION (new_tree)->x_ix86_unsafe_math_optimizat= ions || (flag_excess_precision !=3D TREE_TARGET_OPTION (new_tree)->x_ix86_excess_precision)) { cl_target_option_restore (&global_options, &global_options_set, TREE_TARGET_OPTION (new_tree)); ix86_excess_precision =3D flag_excess_precision; ix86_unsafe_math_optimizations =3D flag_unsafe_math_optimizations; DECL_FUNCTION_SPECIFIC_TARGET (fndecl) =3D new_tree =3D build_target_option_node (&global_options, &global_options_set); if (TREE_TARGET_GLOBALS (new_tree)) restore_target_globals (TREE_TARGET_GLOBALS (new_tree)); else if (new_tree =3D=3D target_option_default_node) restore_target_globals (&default_target_globals); else TREE_TARGET_GLOBALS (new_tree) =3D save_target_globals_default_opts= (); } it calls save_target_globals_default_opts for new target globals. Note that= the previous ira_int in target global has been initialized by backend_init_targ= et, while this new created target global doesn't, it's associated to the target node newly created for main. There is no other places to initialize ira_int= , so it gets ICE during ira pass.=