From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from albireo.enyo.de (albireo.enyo.de [37.24.231.21]) by sourceware.org (Postfix) with ESMTPS id 2411C3858D28 for ; Sun, 26 Mar 2023 10:35:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2411C3858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=deneb.enyo.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=deneb.enyo.de Received: from [172.17.203.2] (port=52473 helo=deneb.enyo.de) by albireo.enyo.de ([172.17.140.2]) with esmtps (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) id 1pgNiM-00FFgu-Au; Sun, 26 Mar 2023 10:35:06 +0000 Received: from fw by deneb.enyo.de with local (Exim 4.96) (envelope-from ) id 1pgNiM-001nWZ-0b; Sun, 26 Mar 2023 12:35:06 +0200 From: Florian Weimer To: Paul Pluzhnikov via Libc-alpha Cc: Paul Pluzhnikov , Andreas Schwab Subject: Re: [PATCH] Minor: don't call _dl_debug_update (which can have side effects) inside assert References: <87h6u8xz2y.fsf@mid.deneb.enyo.de> <20230326002358.1244787-1-ppluzhnikov@google.com> Date: Sun, 26 Mar 2023 12:35:06 +0200 In-Reply-To: <20230326002358.1244787-1-ppluzhnikov@google.com> (Paul Pluzhnikov via Libc-alpha's message of "Sun, 26 Mar 2023 00:24:00 +0000") Message-ID: <875yanyf51.fsf@mid.deneb.enyo.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP 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: * Paul Pluzhnikov via Libc-alpha: > On Sat, Mar 25, 2023 at 3:09=E2=80=AFPM Florian Weimer = wrote: > >> This needs __attribute__ ((unused)) on r_state to support building >> with -DNDEBUG (although I have not tested that). > > Thanks. Revised patch included. > > --- > elf/dl-open.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/elf/dl-open.c b/elf/dl-open.c > index 91a2d8a538..2d985e21d8 100644 > --- a/elf/dl-open.c > +++ b/elf/dl-open.c > @@ -578,7 +578,9 @@ dl_open_worker_begin (void *a) > if ((mode & RTLD_GLOBAL) && new->l_global =3D=3D 0) > add_to_global_update (new); >=20=20 > - assert (_dl_debug_update (args->nsid)->r_state =3D=3D RT_CONSISTEN= T); > + const int r_state __attribute__ ((unused)) > + =3D _dl_debug_update (args->nsid)->r_state; > + assert (r_state =3D=3D RT_CONSISTENT); >=20=20 > return; > } > @@ -927,7 +929,9 @@ no more namespaces available for dlmopen()")); > _dl_signal_exception (errcode, &exception, NULL); > } >=20=20 > - assert (_dl_debug_update (args.nsid)->r_state =3D=3D RT_CONSISTENT); > + const int r_state __attribute__ ((unused)) > + =3D _dl_debug_update (args.nsid)->r_state; > + assert (r_state =3D=3D RT_CONSISTENT); >=20=20 > /* Release the lock. */ > __rtld_lock_unlock_recursive (GL(dl_load_lock)); This version looks okay to me, thanks.