public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@redhat.com>
To: gcc-patches@gcc.gnu.org,	jit@gcc.gnu.org
Cc: David Malcolm <dmalcolm@redhat.com>
Subject: [committed] jit: fix ICE with GCC_JIT_BOOL_OPTION_SELFCHECK_GC since r278084 (PR jit/92483)
Date: Tue, 01 Jan 2019 00:00:00 -0000	[thread overview]
Message-ID: <1574272888-47942-1-git-send-email-dmalcolm@redhat.com> (raw)

Since r278084 (part of the params refactoring), most of libgccjit's
test suite has been ICEing.

The root cause is that jit-playback.c injects params to its fake_args
here:

  /* Aggressively garbage-collect, to shake out bugs: */
  if (get_bool_option (GCC_JIT_BOOL_OPTION_SELFCHECK_GC))
    {
      ADD_ARG ("--param");
      ADD_ARG ("ggc-min-expand=0");
      ADD_ARG ("--param");
      ADD_ARG ("ggc-min-heapsize=0");
    }

(building a vec of char * where the char * are allocated using xstrdup)

and r278084 added this logic to decode_cmdline_options_to_array:

964	      /* Interpret "--param" "key=name" as "--param=key=name".  */
965	      const char *needle = "--param";
966	      if (i + 1 < argc && strcmp (opt, needle) == 0)
967		{
968		  const char *replacement
969		    = opts_concat (needle, "=", argv[i + 1], NULL);
970		  argv[++i] = replacement;
971		}

Note that at line 970 it manipulates the argv in-place, inserting a
new option allocated with opts_concat, which uses opts_obstack
(itself initialized from toplev::main).

jit-playback.c cleans up its fake arguments using "free", at which
point we have a free of the middle of an obstack and an ICE.

This patch fixes the issue by using the new syntax for the params.

Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.

Fixes all 60 FAILs in jit.sum, restoring the number of PASS results
from 2033 to 10469.

Committed to trunk as r278515.

gcc/jit/ChangeLog:
	PR jit/92483
	* jit-playback.c (gcc::jit::playback::context::make_fake_args):
	Update GCC_JIT_BOOL_OPTION_SELFCHECK_GC for new --param syntax.
---
 gcc/jit/jit-playback.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/gcc/jit/jit-playback.c b/gcc/jit/jit-playback.c
index 9eeb2a7..c043d69 100644
--- a/gcc/jit/jit-playback.c
+++ b/gcc/jit/jit-playback.c
@@ -2273,10 +2273,8 @@ make_fake_args (vec <char *> *argvec,
   /* Aggressively garbage-collect, to shake out bugs: */
   if (get_bool_option (GCC_JIT_BOOL_OPTION_SELFCHECK_GC))
     {
-      ADD_ARG ("--param");
-      ADD_ARG ("ggc-min-expand=0");
-      ADD_ARG ("--param");
-      ADD_ARG ("ggc-min-heapsize=0");
+      ADD_ARG ("--param=ggc-min-expand=0");
+      ADD_ARG ("--param=ggc-min-heapsize=0");
     }
 
   if (get_bool_option (GCC_JIT_BOOL_OPTION_DUMP_EVERYTHING))
-- 
1.8.5.3

                 reply	other threads:[~2019-11-20 17:54 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=1574272888-47942-1-git-send-email-dmalcolm@redhat.com \
    --to=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).