From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 86980 invoked by alias); 20 Nov 2019 17:54:43 -0000 Mailing-List: contact jit-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Subscribe: Sender: jit-owner@gcc.gnu.org Received: (qmail 86872 invoked by uid 89); 20 Nov 2019 17:54:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.3 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-22.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3 autolearn=unavailable version=3.3.1 spammy= X-Spam-Status: No, score=-22.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3 autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sourceware.org X-Spam-Level: X-HELO: us-smtp-delivery-1.mimecast.com Received: from us-smtp-2.mimecast.com (HELO us-smtp-delivery-1.mimecast.com) (205.139.110.61) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 20 Nov 2019 17:54:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574272480; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZR08FknBwcpSOMDTKHIoPUdBkOOKj1mRqiYyMStEdL4=; b=acxv2l6jE+LwgXy5fMP5EJsfAHHLElcz96IWh4d97UH1U9B4IIp/RyrJd6/9hpzHAtekVn KBgdp44bEgAjZWQC+GKJ0wWIQKN2WetNlb3uVIwEAsH7/J5Whu47mcQawY8X8Ik1kIYEli nWW6ZB+heLrD9TWPgSm+uNw9IJKr8qs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-410-CtbP4yKbODiUlpPiZoqLiA-1; Wed, 20 Nov 2019 12:54:37 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2DD311005509; Wed, 20 Nov 2019 17:54:36 +0000 (UTC) Received: from c64.redhat.com (ovpn-112-19.phx2.redhat.com [10.3.112.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0F9265D6BE; Wed, 20 Nov 2019 17:54:34 +0000 (UTC) From: David Malcolm To: gcc-patches@gcc.gnu.org, jit@gcc.gnu.org Cc: David Malcolm 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 Message-Id: <1574272888-47942-1-git-send-email-dmalcolm@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: CtbP4yKbODiUlpPiZoqLiA-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2019-q4/txt/msg00006.txt.bz2 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=3D0"); ADD_ARG ("--param"); ADD_ARG ("ggc-min-heapsize=3D0"); } (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=3Dname" as "--param=3Dkey=3Dname". */ 965 const char *needle =3D "--param"; 966 if (i + 1 < argc && strcmp (opt, needle) =3D=3D 0) 967 { 968 const char *replacement 969 =3D opts_concat (needle, "=3D", argv[i + 1], NULL); 970 argv[++i] =3D 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 *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=3D0"); - ADD_ARG ("--param"); - ADD_ARG ("ggc-min-heapsize=3D0"); + ADD_ARG ("--param=3Dggc-min-expand=3D0"); + ADD_ARG ("--param=3Dggc-min-heapsize=3D0"); } =20 if (get_bool_option (GCC_JIT_BOOL_OPTION_DUMP_EVERYTHING)) --=20 1.8.5.3