public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "linkw at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-105459-4-tIAoiWt9WF@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105459-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105459

Kewen Lin <linkw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #6 from Kewen Lin <linkw at gcc dot gnu.org> ---
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 the
same target option node with main, when switching back to main, it hits the
condition in 

  else if (flag_unsafe_math_optimizations
           != TREE_TARGET_OPTION (new_tree)->x_ix86_unsafe_math_optimizations
           || (flag_excess_precision
               != 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 = flag_excess_precision;
      ix86_unsafe_math_optimizations = flag_unsafe_math_optimizations;
      DECL_FUNCTION_SPECIFIC_TARGET (fndecl) = new_tree
        = 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 == target_option_default_node)
        restore_target_globals (&default_target_globals);
      else
        TREE_TARGET_GLOBALS (new_tree) = 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_target,
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.

  parent reply	other threads:[~2022-05-17  9:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-03  5:24 [Bug rtl-optimization/105459] New: ICE: Segmentation fault (in record_operand_costs) asolokha at gmx dot com
2022-05-03  7:07 ` [Bug rtl-optimization/105459] " rguenth at gcc dot gnu.org
2022-05-03  8:46 ` [Bug rtl-optimization/105459] [12/13 Regression] ICE: Segmentation fault (in record_operand_costs) since r12-3721-g63c6446f77b9001d marxin at gcc dot gnu.org
2022-05-03  8:47 ` marxin at gcc dot gnu.org
2022-05-03  9:00 ` rguenth at gcc dot gnu.org
2022-05-05  5:45 ` linkw at gcc dot gnu.org
2022-05-06  8:33 ` jakub at gcc dot gnu.org
2022-05-17  9:08 ` linkw at gcc dot gnu.org [this message]
2022-05-17  9:10 ` linkw at gcc dot gnu.org
2022-05-23  6:28 ` linkw at gcc dot gnu.org
2022-05-23  8:14 ` linkw at gcc dot gnu.org
2022-05-25  7:43 ` linkw at gcc dot gnu.org
2022-06-02  2:15 ` linkw at gcc dot gnu.org
2022-06-02  2:18 ` linkw at gcc dot gnu.org
2022-07-11  9:22 ` cvs-commit at gcc dot gnu.org
2022-07-11  9:22 ` [Bug rtl-optimization/105459] [12 " rguenth at gcc dot gnu.org
2022-07-19 11:37 ` cvs-commit at gcc dot gnu.org
2022-07-19 11:38 ` rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-105459-4-tIAoiWt9WF@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).