public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libgccjit: Clear pending_assemble_externals_processed
@ 2024-02-08 22:09 Antoni Boucher
  2024-02-15 14:33 ` Antoni Boucher
  2024-02-15 15:35 ` David Malcolm
  0 siblings, 2 replies; 5+ messages in thread
From: Antoni Boucher @ 2024-02-08 22:09 UTC (permalink / raw)
  To: gcc-patches, jit; +Cc: David Malcolm

[-- 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] libgccjit: Clear pending_assemble_externals_processed
  2024-02-08 22:09 [PATCH] libgccjit: Clear pending_assemble_externals_processed Antoni Boucher
@ 2024-02-15 14:33 ` Antoni Boucher
  2024-02-15 15:35 ` David Malcolm
  1 sibling, 0 replies; 5+ messages in thread
From: Antoni Boucher @ 2024-02-15 14:33 UTC (permalink / raw)
  To: gcc-patches, jit; +Cc: David Malcolm

David: Ping.

On Thu, 2024-02-08 at 17:09 -0500, Antoni Boucher wrote:
> 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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] libgccjit: Clear pending_assemble_externals_processed
  2024-02-08 22:09 [PATCH] libgccjit: Clear pending_assemble_externals_processed Antoni Boucher
  2024-02-15 14:33 ` Antoni Boucher
@ 2024-02-15 15:35 ` David Malcolm
  2024-02-15 19:14   ` Antoni Boucher
  1 sibling, 1 reply; 5+ messages in thread
From: David Malcolm @ 2024-02-15 15:35 UTC (permalink / raw)
  To: Antoni Boucher, gcc-patches, jit

On Thu, 2024-02-08 at 17:09 -0500, Antoni Boucher wrote:
> 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.

Thanks; patch looks good for trunk, assuming you've tested it on a
target that defines ASM_OUTPUT_EXTERNAL.

Dave


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] libgccjit: Clear pending_assemble_externals_processed
  2024-02-15 15:35 ` David Malcolm
@ 2024-02-15 19:14   ` Antoni Boucher
  2024-02-15 19:23     ` David Malcolm
  0 siblings, 1 reply; 5+ messages in thread
From: Antoni Boucher @ 2024-02-15 19:14 UTC (permalink / raw)
  To: David Malcolm, gcc-patches, jit

It's OK to merge even though it touches files outside of the jit
directory and we're in stage 4?
Or do we need some kind of approval?

On Thu, 2024-02-15 at 10:35 -0500, David Malcolm wrote:
> On Thu, 2024-02-08 at 17:09 -0500, Antoni Boucher wrote:
> > 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.
> 
> Thanks; patch looks good for trunk, assuming you've tested it on a
> target that defines ASM_OUTPUT_EXTERNAL.
> 
> Dave
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] libgccjit: Clear pending_assemble_externals_processed
  2024-02-15 19:14   ` Antoni Boucher
@ 2024-02-15 19:23     ` David Malcolm
  0 siblings, 0 replies; 5+ messages in thread
From: David Malcolm @ 2024-02-15 19:23 UTC (permalink / raw)
  To: Antoni Boucher, gcc-patches, jit

On Thu, 2024-02-15 at 14:14 -0500, Antoni Boucher wrote:
> It's OK to merge even though it touches files outside of the jit
> directory and we're in stage 4?
> Or do we need some kind of approval?

I think this patch is sufficiently low-risk that you can go ahead and
merge it.

Dave

> 
> On Thu, 2024-02-15 at 10:35 -0500, David Malcolm wrote:
> > On Thu, 2024-02-08 at 17:09 -0500, Antoni Boucher wrote:
> > > 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.
> > 
> > Thanks; patch looks good for trunk, assuming you've tested it on a
> > target that defines ASM_OUTPUT_EXTERNAL.
> > 
> > Dave
> > 
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-02-15 19:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-08 22:09 [PATCH] libgccjit: Clear pending_assemble_externals_processed Antoni Boucher
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

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).