public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug lto/105399] [12 Regression] -O2/-Ofast -flto ICEs as internal compiler error: verify_cgraph_node failed Date: Wed, 27 Apr 2022 09:03:35 +0000 [thread overview] Message-ID: <bug-105399-4-umTL07qSYf@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-105399-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105399 --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Because of -Ofast initial compilation, opt_for_fn (decl, flag_semantic_interposition) is false for all the decls for which a cgraph node is created, but they have NULL DECL_FUNCTION_SPECIFIC_OPTIMIZATION, and thus they look up the bit in optimization_default_node. That results in node->semantic_interposition to be 0 as well. Next comes free_lang_data_in_decl, which does: if (TREE_CODE (decl) == FUNCTION_DECL) ... if (gimple_has_body_p (decl) || (node && node->thunk)) ... if (!DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl)) DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl) = optimization_default_node; Now, free_lang_data_in_decl is called on 3 FUNCTION_DECLs, _ZN1SC1Ev aka __ct_comp, which is node->alias && !node->semantic_interposition, gimple_has_body_p (decl) is false for it and we don't do anything. Next it is called on _ZN1SC4Ev aka __ct, which has NULL node and gimple_has_body_p (decl) is false for it too. Last it is called for _ZN1SC2Ev aka __ct_base, which is !node->alias && !node->semantic_interposition, gimple_has_body_p (decl) is true and we set DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl) to optimization_default_node. Then we stream all this out, and stream it back, except that optimization_default_node is one for -O2 with x_flag_semantic_interposition set for it. _ZN1SC2Ev passes the verification, node->semantic_interposition is false and opt_for_fn (decl, flag_semantic_interposition) is false as well. But for _ZN1SC1Ev we ICE on: if (definition && externally_visible && semantic_interposition != opt_for_fn (decl, flag_semantic_interposition)) { error ("semantic interposition mismatch"); error_found = true; } That is because for aliases which don't have a body, we kept DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl) NULL. One way to fix this would be - if (definition && externally_visible + if (definition + && externally_visible + && (!alias || thunk) && semantic_interposition != opt_for_fn (decl, flag_semantic_interposition)) { error ("semantic interposition mismatch"); error_found = true; } i.e. don't bother verification of mismatches for aliases. Another would be to adjust DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl) in free_lang_data_in_decl even for aliases.
next prev parent reply other threads:[~2022-04-27 9:03 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-04-26 22:27 [Bug lto/105399] New: " slyfox at gcc dot gnu.org 2022-04-27 6:10 ` [Bug lto/105399] " rguenth at gcc dot gnu.org 2022-04-27 8:49 ` marxin at gcc dot gnu.org 2022-04-27 9:03 ` jakub at gcc dot gnu.org [this message] 2022-04-27 9:08 ` jakub at gcc dot gnu.org 2022-04-27 9:57 ` jakub at gcc dot gnu.org 2022-04-28 13:46 ` cvs-commit at gcc dot gnu.org 2022-04-28 13:49 ` jakub 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-105399-4-umTL07qSYf@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: linkBe 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).