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 011DF385DC0E for ; Wed, 10 Jan 2024 14:32:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 011DF385DC0E 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 011DF385DC0E 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=1704897125; cv=none; b=LoJFMxbtmUxLU/DHGLTT1I37FCLwxx+26GbPEm42sDQJxe7yAxEUDtk+Bs1X4fwAPCp112lb7JL46NdTJfJXNKTPcoIQ65GIulUPHZPjEF4RVex/QemFUcIHzlfoUmF39wQSIlzDNUAMXp4Y2iPClcqXuhX7DJBbul8kP+Ej03M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704897125; c=relaxed/simple; bh=Vi5Z14tMUK/3WA/J38zQ8V4kWmyLc7swKpoT2ecQJ1I=; h=DKIM-Signature:Message-ID:Subject:From:To:Date:MIME-Version; b=iliOJ3xq6n9BHVjkxguqj8jeFlJF4VdesnbATxwlzdYY+QyZz7JJLwdSt06szQ1L65NqoJxYZ+AK2e6IQV2pthgwnJGwdl1jVDJ4hs9CpB80SKBvw+CK6QKQwT9tgXDJ0UJrJRnrz58GS8aVHVtHeW2KE79gUyhEVIQiQSZmbZA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704897123; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Vi5Z14tMUK/3WA/J38zQ8V4kWmyLc7swKpoT2ecQJ1I=; b=bIlHq3qNCHaj14yI6bjKyHV2FSUaHa/gZKamnmInzRW7maLB+5jo0hbK/RkA1lyJXVQi/d ezkv+owW3q0JGIRy5qaJuNxWHQVThu0ObGBQMhQautNpl/dqgQ1Pa/1xEkC9EKjK7LXxZ2 5ogIqiIx6dTD1jntXbZapDu+yzc8nhM= 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-534-iI8Lg4j2NcyiukZEioFHww-1; Wed, 10 Jan 2024 09:32:02 -0500 X-MC-Unique: iI8Lg4j2NcyiukZEioFHww-1 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-680b7da38bcso82376226d6.3 for ; Wed, 10 Jan 2024 06:32:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704897121; x=1705501921; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Vi5Z14tMUK/3WA/J38zQ8V4kWmyLc7swKpoT2ecQJ1I=; b=EQCJSk9Z7iIB1soykjHfUpxVfvzTHr+A6oBhDqETl3dLexboDZjV5qHlWyKOZsNNmI JXja7DA5tmwGg4QbAGspc7k4qCDM0Ts/yJUN+a+z5gb5PVHLKySFm1sJIV7iNN+V5M97 M02+cPw2/8/1Yc7De311jnawAnY+jQkqREFipYZCmy06Z45nJOWJKQwJBY7IboGHfLuM yG4ZtH1rdVnmpykgLOxm0Y+KBO9E9WiMVLr7rYQOyEbsYgDnueBsbsHyn6mhJsoA0NpT B/yqrSpYXgviC6woNpwNsMhSNf7JzTxOjDzuZdDgBpCqcB4UgxNK8GIn2PyZogfDJaW6 I2vQ== X-Gm-Message-State: AOJu0Yz9Is0Vxo+jvTA6aZsY1qVJsIkckPnJyIehC2CHSRMu32c5W93G 5IrgoOCQDLQQirlH2N0Jcz9ak2Sakxa0mA0WjaRYRgluEaR1+fA0uN+JBBtHB/cpPuAEpdwysZ/ 2a8Wq6pBCLe9TAH8= X-Received: by 2002:a05:622a:110b:b0:429:9e27:6e84 with SMTP id e11-20020a05622a110b00b004299e276e84mr1158631qty.80.1704897121720; Wed, 10 Jan 2024 06:32:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IEBPLL9V/EYB/VzP4BQ6G1O2rVM0SIYkxV6k8USynUb/4z/ZA3LES5xmvNKppc0b0kCKZB0sQ== X-Received: by 2002:a05:622a:110b:b0:429:9e27:6e84 with SMTP id e11-20020a05622a110b00b004299e276e84mr1158616qty.80.1704897121397; Wed, 10 Jan 2024 06:32:01 -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 h20-20020ac85154000000b00419732075b4sm1797766qtn.84.2024.01.10.06.32.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 06:32:01 -0800 (PST) Message-ID: <38ce46b90b2c0b4ddff3c68bf6dd11689b874e8c.camel@redhat.com> Subject: Re: [PATCH] libgccjit: Fix ira cost segfault From: David Malcolm To: Antoni Boucher , jit@gcc.gnu.org, gcc-patches@gcc.gnu.org Cc: Jan Hubicka , Uros Bizjak Date: Wed, 10 Jan 2024 09:32:00 -0500 In-Reply-To: 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=-9.8 required=5.0 tests=BAYES_00,BODY_8BITS,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 Wed, 2024-01-10 at 09:30 -0500, David Malcolm wrote: > 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. >=20 > Hi Antoni >=20 > Thanks for the patch; sorry for missing it before. >=20 > CCing the i386 maintainers; quoting the patch here to give them > context: Oops; actually adding them to the CC this time; sorry. >=20 > > 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: > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0PR jit/112575 > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* config/i386/i386-opti= ons.cc > > (ix86_option_override_internal): > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0Cleanup target_attribut= e_cache. > > --- > > =C2=A0gcc/config/i386/i386-options.cc | 6 ++++++ > > =C2=A01 file changed, 6 insertions(+) > >=20 > > diff --git a/gcc/config/i386/i386-options.cc > > b/gcc/config/i386/i386-options.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, > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=3D opts->x_flag_unsafe= _math_optimizations; > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 target_option_default_node =3D tar= get_option_current_node > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D build_target_optio= n_node (opts, opts_set); > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* TODO: check if this is the correct l= ocation.=C2=A0 It should > > probably be in > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 some finalizer function, bu= t I don't > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 know if there's one.=C2=A0 = */ > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 target_attribute_cache[0] =3D NULL; > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 target_attribute_cache[1] =3D NULL; > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 target_attribute_cache[2] =3D NULL; > > =C2=A0=C2=A0=C2=A0=C2=A0 } > > =C2=A0 > > =C2=A0=C2=A0 if (opts->x_flag_cf_protection !=3D CF_NONE) > > --=20 > > 2.42.1 > >=20 >=20 > Presumably this happens when there's more than one in-process > invocation of the compiler code (via libgccjit). >=20 > >=20 > > I'm also not sure I put the cleanup in the correct location. > > Is there any finalizer function for target specific code? >=20 > 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). >=20 > There doesn't seem to be any kind of hook at this time for calling > target-specific cleanups from toplev::finalize. >=20 > However, as of r14-4003-geaa8e8541349df ggc_common_finalize zeroes > everything marked with GTY.=C2=A0 The array target_attribute_cache does > have > a GTY marking, so perhaps as of that commit this patch isn't > necessary? >=20 > 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 > >=20 > > Thanks to fix this issue. >=20 > Dave