From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 6E5823858C66 for ; Wed, 10 Jan 2024 14:30:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6E5823858C66 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6E5823858C66 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704897054; cv=none; b=V+dsjrDWlZzVMnWXY9Tr0Px7sQVU102G4OplESGf+b9xM21s4L2HJLXj2GOhp5bRYBBwjBgOJveZ++18VZk3jAmbtV1xZUoP2OEn0gTzls+fKzJlnRW2u+/g1x5R3ppM8BOWzVuGRrTkoZ4R73vvj2E+67fVDwiyvuJ5wujUibA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704897054; c=relaxed/simple; bh=QZR+2D8n37OFu+OQjgv+4YUomd9knLiNvMG0018IOuI=; h=DKIM-Signature:Message-ID:Subject:From:To:Date:MIME-Version; b=E2LlnQOtvAmR++zdgGRfCSW/542A1fI3wLLpk+vLk6gsbrtH4WbVLyqzrLCB5jYRulWGFlo3uPUZ8lFATkROJqks61bWyk78CY9usL4un1Uw7ZwXt+eiOJxKHsMwahEQmewXJxz7F4ydSNBsASSBXiJHVFdsqSed1NFGvxt4PCc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704897051; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aWHAWtD5P8OQarQDoOSXhbmsmUrHhg09BLePh4mcjzk=; b=e/c17QJ2ESokdsGnDN1eSjDA8o3+gXLQUR9bJyNjwcJIhKhCR/MBZi+XWhLjGrViI0CzQ5 bD1u4vXrQi2bvgMIumcApmxwWeSkFGxe4oOwFzIKfr6jUb/xR2ow9GRoZYKdiEfw9azTnU BSD5jrDluJibW14s6vgHgMOqE0gxOpw= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-544-A30Ee0YnMjmKWGMrcMwoOQ-1; Wed, 10 Jan 2024 09:30:50 -0500 X-MC-Unique: A30Ee0YnMjmKWGMrcMwoOQ-1 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-680d22713dfso66336716d6.3 for ; Wed, 10 Jan 2024 06:30:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704897049; x=1705501849; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=goc86nfHu/pczIL9xVbv2QXEah07PkENRxMWsD3CBpg=; b=kDEuNYNHsfzyoyOYf2dkw7sYzV5y0aWWgb86OzogHkjw9tT83ilA0nA8P3ixKlDyWE jLJUYrmlYXYfFPmChg9CIr77X81P086xvGKn5GFDT8tARv5dH0oj4eh8BA09VJwBUP10 S+dwrEpsTTaSd0zTwc7B2oF3IOncDEurGpAIx+0oYih0f3SfRBoDX9MTXEjsAVyp70kK 2i1ida9r589BMdVYT8hpCL8mbK1kNUL/nWnKyrCwmgTCeByPu7uM6D64ziITGawAwopO XHOk0KuCnnnSiPPe3lgGCmBvB0aCHnhtl8Mei3TnApRYg3eBq6SoJxydMqRQLBJ2nHsD cesw== X-Gm-Message-State: AOJu0YyzW2h5fviSVNl0wjJykkAzucK+GrXGTpn9ah9kggZsCiwxsWTT m50EYvpX9V8kAlhsxZhwhYB6ot93jghgCnPCZ9KwLDRL/hJuDthqXzxKeV//Mja2VKMYtorUIu4 H/GqDWkdiObUEjS42dY81MDo= X-Received: by 2002:ad4:5741:0:b0:680:ff1b:9481 with SMTP id q1-20020ad45741000000b00680ff1b9481mr1313262qvx.108.1704897049274; Wed, 10 Jan 2024 06:30:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IGRsUGV13Jgee67eE6NR2LUj/4S3xwpA8wAWUgej+1OV0SSbxg9q8AH9EhmbhjMxnNA4VZ6Hg== X-Received: by 2002:ad4:5741:0:b0:680:ff1b:9481 with SMTP id q1-20020ad45741000000b00680ff1b9481mr1313253qvx.108.1704897049007; Wed, 10 Jan 2024 06:30:49 -0800 (PST) Received: from t14s.localdomain (c-76-28-97-5.hsd1.ma.comcast.net. [76.28.97.5]) by smtp.gmail.com with ESMTPSA id d10-20020a0cc68a000000b00680613267d5sm1738517qvj.115.2024.01.10.06.30.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 06:30:48 -0800 (PST) Message-ID: Subject: Re: [PATCH] libgccjit: Fix ira cost segfault From: David Malcolm To: Antoni Boucher , jit@gcc.gnu.org, gcc-patches@gcc.gnu.org Date: Wed, 10 Jan 2024 09:30:47 -0500 In-Reply-To: <531885fa576a672454e6630549858842588c800e.camel@zoho.com> References: <531885fa576a672454e6630549858842588c800e.camel@zoho.com> User-Agent: Evolution 3.44.4 (3.44.4-2.fc36) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_SORBS_WEB,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, 2023-11-16 at 17:28 -0500, Antoni Boucher wrote: > Hi. > This patch fixes a segfault that happens when compiling librsvg (more > specifically its dependency aho-corasick) with rustc_codegen_gcc (bug > 112575). > I was not able to create a reproducer for this bug: I'm assuming I > might need to concat all the reproducers together in the same file in > order to be able to reproduce the issue. Hi Antoni Thanks for the patch; sorry for missing it before. CCing the i386 maintainers; quoting the patch here to give them context: > From e0f4f51682266bc9f507afdb64908ed3695a2f5e Mon Sep 17 00:00:00 2001 > From: Antoni Boucher > Date: Thu, 2 Nov 2023 17:18:35 -0400 > Subject: [PATCH] libgccjit: Fix ira cost segfault >=20 > gcc/ChangeLog: > =09PR jit/112575 > =09* config/i386/i386-options.cc (ix86_option_override_internal): > =09Cleanup target_attribute_cache. > --- > gcc/config/i386/i386-options.cc | 6 ++++++ > 1 file changed, 6 insertions(+) >=20 > diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-optio= ns.cc > index df7d24352d1..f596c0fb53c 100644 > --- a/gcc/config/i386/i386-options.cc > +++ b/gcc/config/i386/i386-options.cc > @@ -3070,6 +3070,12 @@ ix86_option_override_internal (bool main_args_p, > =09=3D opts->x_flag_unsafe_math_optimizations; > target_option_default_node =3D target_option_current_node > =3D build_target_option_node (opts, opts_set); > + /* TODO: check if this is the correct location. It should probabl= y be in > +=09 some finalizer function, but I don't > +=09 know if there's one. */ > + target_attribute_cache[0] =3D NULL; > + target_attribute_cache[1] =3D NULL; > + target_attribute_cache[2] =3D NULL; > } > =20 > if (opts->x_flag_cf_protection !=3D CF_NONE) > --=20 > 2.42.1 >=20 Presumably this happens when there's more than one in-process invocation of the compiler code (via libgccjit). >=20 > I'm also not sure I put the cleanup in the correct location. > Is there any finalizer function for target specific code? As you know (but the i386 maintainers might not), to allow multiple in- process invocations of the compiler code (for libgccjit) we've been putting code to reset global state in various {filename_cc}_finalize functions called from toplev::finalize (see the end of toplev.cc). There doesn't seem to be any kind of hook at this time for calling target-specific cleanups from toplev::finalize. However, as of r14-4003-geaa8e8541349df ggc_common_finalize zeroes everything marked with GTY. The array target_attribute_cache does have a GTY marking, so perhaps as of that commit this patch isn't necessary? Otherwise, if special-casing this is required, sorry: I'm not familiar enough with i386-options.cc to know if the patch is correct. >=20 > Thanks to fix this issue. Dave