public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Eric Botcazou <ebotcazou@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r10-10316] Fix -freorder-blocks-and-partition glitch with Windows SEH (continued) Date: Tue, 30 Nov 2021 09:23:14 +0000 (GMT) [thread overview] Message-ID: <20211130092314.28F293857C67@sourceware.org> (raw) https://gcc.gnu.org/g:ecc34ba16920957de21f89fc8b4c9efef7786f72 commit r10-10316-gecc34ba16920957de21f89fc8b4c9efef7786f72 Author: Eric Botcazou <ebotcazou@adacore.com> Date: Tue Nov 30 10:17:09 2021 +0100 Fix -freorder-blocks-and-partition glitch with Windows SEH (continued) This fixes a thinko in the fix for the -freorder-blocks-and-partition glitch with SEH on 64-bit Windows: https://gcc.gnu.org/pipermail/gcc-patches/2021-February/565208.html Even if no exceptions are active, e.g. in C, we need to consider calls. gcc/ PR target/103274 * config/i386/i386.c (ix86_output_call_insn): Beef up comment about nops emitted with SEH. * config/i386/winnt.c (i386_pe_seh_unwind_emit): When switching to the cold section, emit a nop before the directive if the previous active instruction is a call. Diff: --- gcc/config/i386/i386.c | 6 ++++-- gcc/config/i386/winnt.c | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index fe381331c5e..44e4be58c39 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -15851,8 +15851,10 @@ ix86_output_call_insn (rtx_insn *insn, rtx call_op) break; /* If we get to the epilogue note, prevent a catch region from - being adjacent to the standard epilogue sequence. If non- - call-exceptions, we'll have done this during epilogue emission. */ + being adjacent to the standard epilogue sequence. Note that, + if non-call exceptions are enabled, we already did it during + epilogue expansion, or else, if the insn can throw internally, + we already did it during the reorg pass. */ if (NOTE_P (i) && NOTE_KIND (i) == NOTE_INSN_EPILOGUE_BEG && !flag_non_call_exceptions && !can_throw_internal (insn)) diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c index a39d09f06da..92510efa985 100644 --- a/gcc/config/i386/winnt.c +++ b/gcc/config/i386/winnt.c @@ -1244,9 +1244,9 @@ i386_pe_seh_unwind_emit (FILE *asm_out_file, rtx_insn *insn) seh = cfun->machine->seh; if (NOTE_P (insn) && NOTE_KIND (insn) == NOTE_INSN_SWITCH_TEXT_SECTIONS) { - /* See ix86_seh_fixup_eh_fallthru for the rationale. */ + /* See ix86_output_call_insn/seh_fixup_eh_fallthru for the rationale. */ rtx_insn *prev = prev_active_insn (insn); - if (prev && !insn_nothrow_p (prev)) + if (prev && (CALL_P (prev) || !insn_nothrow_p (prev))) fputs ("\tnop\n", asm_out_file); fputs ("\t.seh_endproc\n", asm_out_file); seh->in_cold_section = true;
reply other threads:[~2021-11-30 9:23 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20211130092314.28F293857C67@sourceware.org \ --to=ebotcazou@gcc.gnu.org \ --cc=gcc-cvs@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).