unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Szabolcs Nagy <Szabolcs.Nagy@arm.com>
To: "fweimer@redhat.com" <fweimer@redhat.com>,
	"libc-alpha@sourceware.org" <libc-alpha@sourceware.org>,
	"Florian Weimer (Code Review)"
	<gerrit@gnutoolchain-gerrit.osci.io>
Cc: nd <nd@arm.com>
Subject: Re: [review] slotinfo in struct dtv_slotinfo_list should be flexible array [BZ #25...
Date: Wed, 6 Nov 2019 16:12:11 +0000	[thread overview]
Message-ID: <55ff0c8a-b016-220c-c657-43b2f9308e5b@arm.com> (raw)
In-Reply-To: <gerrit.1572801105000.I51be146a7857186a4ede0bb40b332509487bdde8@gnutoolchain-gerrit.osci.io>

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?

> slotinfo in struct dtv_slotinfo_list should be flexible array [BZ #25097]
> 
> 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.

> -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 define
> -     here the necessary entries.  Note that it is not important whether
> -     there is padding or not since we will always access the information
> -     through the 'si' element.  */
> -  struct dtv_slotinfo info[2 + TLS_SLOTINFO_SURPLUS];
> -} static_slotinfo;
> -
> +static struct dtv_slotinfo_list static_slotinfo =
> +  {
> +   /* Allocate an array of 2 + TLS_SLOTINFO_SURPLUS elements.  */
> +   .slotinfo =  { [array_length (_dl_static_dtv) - 1] = { } },
> +  };

i'd use {0} instead of {} as that's the universal initializer in c.

(to me the original code looked more obvious)

>  static void
>  init_slotinfo (void)
>  {
> -  /* Create the slotinfo list.  */
> -  static_slotinfo.si.len = (((char *) (&static_slotinfo + 1)
> -			     - (char *) &static_slotinfo.si.slotinfo[0])
> -			    / sizeof static_slotinfo.si.slotinfo[0]);
> -  // static_slotinfo.si.next = NULL;	already 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 = array_length (_dl_static_dtv);
> +  /* static_slotinfo.si.next = NULL; -- Already zero.  */

i'd remove the .si in the comment (or remove that comment)


  reply	other threads:[~2019-11-06 16:12 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-03 17:11 [review] slotinfo in struct dtv_slotinfo_list should be flexible array [BZ #25 Florian Weimer (Code Review)
2019-11-06 16:12 ` Szabolcs Nagy [this message]
2019-11-06 16:21   ` Florian Weimer
2019-11-11 15:09     ` Szabolcs Nagy
2019-11-11 15:12       ` Florian Weimer
2019-11-11 21:41         ` Sergio Durigan Junior
2019-11-12 10:22           ` Szabolcs Nagy
2019-11-12 10:35             ` Florian Weimer
2019-11-09 11:44 ` [review v2] " Florian Weimer (Code Review)
2019-11-12 10:40 ` Szabolcs Nagy (Code Review)
2019-11-12 11:47 ` [review v3] " Florian Weimer (Code Review)
2019-11-12 17:29   ` Joseph Myers
2019-11-12 17:42     ` Sandra Loosemore
2019-11-12 18:04       ` Joseph Myers
2019-11-12 18:42       ` Florian Weimer
2019-11-12 20:59         ` Sandra Loosemore
2019-11-13  5:47           ` Florian Weimer
2019-11-13 16:04             ` Sandra Loosemore
2019-11-13 16:25               ` Florian Weimer
2019-11-13 16:06             ` Jeff Law
2019-11-12 22:14         ` Carlos O'Donell
2019-11-12 22:18           ` Florian Weimer
2019-11-12 22:24             ` Carlos O'Donell
2019-11-12 22:26               ` Florian Weimer
2019-11-12 22:39               ` Joseph Myers
2019-11-13  6:18                 ` Florian Weimer
2019-11-13 16:05             ` Jeff Law
2019-11-12 23:12           ` Sandra Loosemore
2019-11-12 23:15             ` Joseph Myers
2019-11-12 12:53 ` Szabolcs Nagy (Code Review)
2019-11-12 13:00 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-11-12 13:00 ` Sourceware to Gerrit sync (Code Review)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55ff0c8a-b016-220c-c657-43b2f9308e5b@arm.com \
    --to=szabolcs.nagy@arm.com \
    --cc=fweimer@redhat.com \
    --cc=gerrit@gnutoolchain-gerrit.osci.io \
    --cc=libc-alpha@sourceware.org \
    --cc=nd@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).