public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
From: Antoni Boucher <bouanto@zoho.com>
To: David Malcolm <dmalcolm@redhat.com>,
	gcc-patches@gcc.gnu.org,  jit@gcc.gnu.org
Subject: Re: [PATCH] libgccjit: Fix infinite recursion in gt_ggc_mx_lang_tree_node
Date: Wed, 10 Jan 2024 18:24:25 -0500	[thread overview]
Message-ID: <4b1e14856ead01a1ed526cfe4cbf1f38a0dc6646.camel@zoho.com> (raw)
In-Reply-To: <e2924da93faec5f1270861aef2e62adc6dbe6be6.camel@redhat.com>

It seems I cannot reproduce the issue.
Should we drop this patch, then?
Or do you think there's value in keeping it?

On Mon, 2022-06-06 at 19:01 -0400, David Malcolm wrote:
> On Thu, 2022-06-02 at 21:23 -0400, Antoni Boucher via Gcc-patches
> wrote:
> > Sorry, forgot to attach the patch.
> > 
> > Here it is.
> > 
> > On Thu, 2022-06-02 at 21:20 -0400, Antoni Boucher via Jit wrote:
> > > Hi.
> > > The attached patch fix bug 105827:
> > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105827
> > > 
> > > I'm not sure how to test this, so please share ideas.
> 
> Do you have a reproducer for this?
> 
> With garbage-collections issues in libgccjit, you can set:
> 
>   gcc_jit_context_set_bool_option (ctxt,
>                                    GCC_JIT_BOOL_OPTION_SELFCHECK_GC,
>                                    1);
> 
> which will force a full garbage collection at every opportunity that
> the collector considers doing one (rather than following heuristics)
> 
> This really slows things down, but makes reproducing crashes much
> more
> deterministic, often turning "it crashes every now and then" to "it
> crashes every time" (and the test suite runs with this enabled).
> 
> > > 
> > > Thanks for the review.
> > 
> 
> > diff --git a/gcc/jit/dummy-frontend.cc b/gcc/jit/dummy-frontend.cc
> > index 84ff359bfe3..8bb5d03d630 100644
> > --- a/gcc/jit/dummy-frontend.cc
> > +++ b/gcc/jit/dummy-frontend.cc
> > @@ -506,13 +506,14 @@ struct GTY(()) lang_identifier
> >  
> >  /* The resulting tree type.  */
> >  
> > +/* See lang_tree_node in gcc/c/c-decl.cc.  */
> >  union GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"),
> > -	   chain_next ("CODE_CONTAINS_STRUCT (TREE_CODE
> > (&%h.generic), TS_COMMON) ? ((union lang_tree_node *) TREE_CHAIN
> > (&%h.generic)) : NULL")))
> > -lang_tree_node
> > -{
> > -  union tree_node GTY((tag ("0"),
> > -		       desc ("tree_node_structure (&%h)")))
> > generic;
> > -  struct lang_identifier GTY((tag ("1"))) identifier;
> > +       chain_next ("(union lang_tree_node *) jit_tree_chain_next
> > (&%h.generic)"))) lang_tree_node
> > + {
> > +  union tree_node GTY ((tag ("0"),
> > +			desc ("tree_node_structure (&%h)")))
> > +    generic;
> > +  struct lang_identifier GTY ((tag ("1"))) identifier;
> >  };
> 
> Those GTY markings on gcc/jit/dummy-frontend.cc's lang_tree_node
> union
> have been like that since my initial proof-of-concept patch back in
> 2013:
>   https://gcc.gnu.org/legacy-ml/gcc-patches/2013-10/msg00228.html
> so presumably I simply copied and pasted that from another frontend
> when I was initially prototyping libgccjit.  There was an element of
> "cargo cult programming" as I was getting the project started.
> 
> Jakub had changed the C and C++ frontends in June 2011 with
> 563007852e8d19b66ec8c1e42e431efaaa967dc6, which introduced the
> c_tree_chain_next that you're now copying in your patch, so
> presumably
> I copied from a different frontend.  My notes say I created the first
> prototype in July 2013, so that's when I would have copied&pasted the
> code.
> 
> Dave
> 
> 
> 
> 
> 
> 


  reply	other threads:[~2024-01-10 23:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-03  1:20 Antoni Boucher
2022-06-03  1:23 ` Antoni Boucher
2022-06-06 23:01   ` David Malcolm
2024-01-10 23:24     ` Antoni Boucher [this message]
2022-06-03  1:23 ` Andrew Pinski

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=4b1e14856ead01a1ed526cfe4cbf1f38a0dc6646.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).