From: Antoni Boucher <bouanto@zoho.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
"jit@gcc.gnu.org" <jit@gcc.gnu.org>
Cc: David Malcolm <dmalcolm@redhat.com>
Subject: [PATCH] libgccjit: Clear pending_assemble_externals_processed
Date: Thu, 08 Feb 2024 17:09:34 -0500 [thread overview]
Message-ID: <7185cf6ab672b0dd4aa7a29bfca1aa14632975e7.camel@zoho.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 174 bytes --]
Hi.
This patch fixes the bug 113842.
I cannot yet add a test with this patch since it requires using
try/catch which is not yet merged in master.
Thanks for the review.
[-- Attachment #2: 0001-libgccjit-Clear-pending_assemble_externals_processed.patch --]
[-- Type: text/x-patch, Size: 1878 bytes --]
From 71f5f5fa8e68594454d5511b6d0c795bc6a8c37a Mon Sep 17 00:00:00 2001
From: Antoni Boucher <bouanto@zoho.com>
Date: Fri, 26 Jan 2024 11:31:47 -0500
Subject: [PATCH] libgccjit: Clear pending_assemble_externals_processed
Without this patch, code using exception handling will fail the
following assert in the function assemble_external_libcall in varasm.cc:
gcc_assert (!pending_assemble_externals_processed)
gcc/ChangeLog:
PR jit/113842
* toplev.cc (toplev::finalize): Call varasm_cc_finalize.
* varasm.cc (varasm_cc_finalize): New function to clear
pending_assemble_externals_processed.
* varasm.h (varasm_cc_finalize): New function.
---
gcc/toplev.cc | 1 +
gcc/varasm.cc | 8 ++++++++
gcc/varasm.h | 2 ++
3 files changed, 11 insertions(+)
diff --git a/gcc/toplev.cc b/gcc/toplev.cc
index 175d4cd18fa..eca8ba292b4 100644
--- a/gcc/toplev.cc
+++ b/gcc/toplev.cc
@@ -2372,6 +2372,7 @@ toplev::finalize (void)
ira_costs_cc_finalize ();
tree_cc_finalize ();
reginfo_cc_finalize ();
+ varasm_cc_finalize ();
/* save_decoded_options uses opts_obstack, so these must
be cleaned up together. */
diff --git a/gcc/varasm.cc b/gcc/varasm.cc
index fa17eff551e..2aa46b498e4 100644
--- a/gcc/varasm.cc
+++ b/gcc/varasm.cc
@@ -8661,4 +8661,12 @@ handle_vtv_comdat_section (section *sect, const_tree decl ATTRIBUTE_UNUSED)
switch_to_comdat_section(sect, DECL_NAME (decl));
}
+void
+varasm_cc_finalize (void)
+{
+#ifdef ASM_OUTPUT_EXTERNAL
+ pending_assemble_externals_processed = false;
+#endif
+}
+
#include "gt-varasm.h"
diff --git a/gcc/varasm.h b/gcc/varasm.h
index d9311dc370b..26e6fab8601 100644
--- a/gcc/varasm.h
+++ b/gcc/varasm.h
@@ -81,4 +81,6 @@ extern rtx assemble_trampoline_template (void);
extern void switch_to_comdat_section (section *, tree);
+extern void varasm_cc_finalize (void);
+
#endif // GCC_VARASM_H
--
2.43.0
next reply other threads:[~2024-02-08 22:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-08 22:09 Antoni Boucher [this message]
2024-02-15 14:33 ` Antoni Boucher
2024-02-15 15:35 ` David Malcolm
2024-02-15 19:14 ` Antoni Boucher
2024-02-15 19:23 ` David Malcolm
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=7185cf6ab672b0dd4aa7a29bfca1aa14632975e7.camel@zoho.com \
--to=bouanto@zoho.com \
--cc=dmalcolm@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jit@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).