From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 54E951F454 for ; Wed, 6 Nov 2019 16:21:20 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=SizL+Ztyg7V9cEq1wzqidxHX69Vu2eY5jjXk27CF4kt kfvW6+kD+P5SVKGtX15T1jDGh1vs0WrXaEW2EsSINC3jYO9lRq7dR6XQcwTV030E O4r7SEJeS3Z5ADhdxRnPiPDTtSXzdSg7YkFmPTE/RKe/8zWzceQMvA2y9wIgZuW4 = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type:content-transfer-encoding; s=default; bh=V6fbQVgjwG88KDcC4I+Fnlugmiw=; b=FikvW4D2pZdqGb9TB wWFOWPt93k+ikFS5ccGPiMOVOnCo1x2XNcmWeznuv1GS7VeYvfKA3Qm5y78ycVoG UJFC4ropxmXLBrt7YHGspxrZjiCcWpbQLL5qd0t+P0EGa+H5o98mgJqqOWX5DyBK 3sf5HhS9+lqw/KOpP5Hl8Fhnes= Received: (qmail 74810 invoked by alias); 6 Nov 2019 16:21:17 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 74793 invoked by uid 89); 6 Nov 2019 16:21:17 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: us-smtp-1.mimecast.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573057273; 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=fBfwK0GuBuLRuis70+T9djtSDiN+kVOasiYy3p91/2s=; b=Ahuc7QD4CCQTXIiaR41qohY8H1mcIyqZz7/T1nHvkbR1XAJl2321efST00ztti/fClmdZf eIG4XyQnMJdpbBqjuiKWJKSsi6Ua/dK9HzmUgyoNNOs+NYPnzXdE2zlKC/+9CrX3owsn7Z WbQwRy7jGeM396sydY4auJtlhtW0rN0= From: Florian Weimer To: Szabolcs Nagy Cc: "libc-alpha\@sourceware.org" , "Florian Weimer \(Code Review\)" , nd Subject: Re: [review] slotinfo in struct dtv_slotinfo_list should be flexible array [BZ #25... References: <55ff0c8a-b016-220c-c657-43b2f9308e5b@arm.com> Date: Wed, 06 Nov 2019 17:21:06 +0100 In-Reply-To: <55ff0c8a-b016-220c-c657-43b2f9308e5b@arm.com> (Szabolcs Nagy's message of "Wed, 6 Nov 2019 16:12:11 +0000") Message-ID: <87bltpm0wd.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable * Szabolcs Nagy: > On 03/11/2019 17:11, Florian Weimer (Code Review) wrote: >> Change URL: https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/489 > > i can't login to gerrit. is there something special i need to do? You need to create an account. I can't seem to send a direct link to the page, but there is a Register link on the sign in page. Afterwards, someone needs to add you to the glibc maintainers group, so that you can give +2s. >> slotinfo in struct dtv_slotinfo_list should be flexible array [BZ #25097= ] >>=20 >> GCC 10 will warn about subscribing inner length zero arrays. Use a GCC >> extension in csu/libc-tls.c to allocate space for the static_slotinfo >> variable. Adjust nptl_db so that the type description machinery does >> not attempt to determine the size of the flexible array member slotinfo. > > the patch looks ok to me. Thanks. >> -static struct >> -{ >> - struct dtv_slotinfo_list si; >> - /* The dtv_slotinfo_list data structure does not include the actual >> - information since it is defined as an array of size zero. We defi= ne >> - here the necessary entries. Note that it is not important whether >> - there is padding or not since we will always access the informatio= n >> - through the 'si' element. */ >> - struct dtv_slotinfo info[2 + TLS_SLOTINFO_SURPLUS]; >> -} static_slotinfo; >> - >> +static struct dtv_slotinfo_list static_slotinfo =3D >> + { >> + /* Allocate an array of 2 + TLS_SLOTINFO_SURPLUS elements. */ >> + .slotinfo =3D { [array_length (_dl_static_dtv) - 1] =3D { } }, >> + }; > > i'd use {0} instead of {} as that's the universal initializer in c. Is it? I don't think that works if the array length is an aggregate. It's true that { } is a GNU extension. > (to me the original code looked more obvious) Maybe, but it's undefined. 8-/ >> static void >> init_slotinfo (void) >> { >> - /* Create the slotinfo list. */ >> - static_slotinfo.si.len =3D (((char *) (&static_slotinfo + 1) >> -=09=09=09 - (char *) &static_slotinfo.si.slotinfo[0]) >> -=09=09=09 / sizeof static_slotinfo.si.slotinfo[0]); >> - // static_slotinfo.si.next =3D NULL;=09already zero >> + /* Create the slotinfo list. Note that the type of static_slotinfo >> + has effectively a zero-length array, so we cannot use the size of >> + static_slotinfo to determine the array length. */ >> + static_slotinfo.len =3D array_length (_dl_static_dtv); >> + /* static_slotinfo.si.next =3D NULL; -- Already zero. */ > > i'd remove the .si in the comment (or remove that comment) Good point. I have to resubmit the series anyway, and will fix it. Thanks, Florian