This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: ToT glibc build problem with ToT GCC
- From: Szabolcs Nagy <Szabolcs dot Nagy at arm dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: nd <nd at arm dot com>, Carlos O'Donell <carlos at redhat dot com>, Martin Sebor <msebor at gmail dot com>, Steve Ellcey <sellcey at marvell dot com>, "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>, "msebor at redhat dot com" <msebor at redhat dot com>
- Date: Tue, 3 Sep 2019 09:51:55 +0000
- Subject: Re: ToT glibc build problem with ToT GCC
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=10h0TFIV3RxyLDlGM8/Rqepxy9f3E9vi9UQF569+iiQ=; b=VlL576EVZAiEVlVAA+oN1zGApJgkyTRVyuftzgmneffzz3r49kN4c2ye2yUY2RvfMR51csoYq6MSkqCWlT527Px9oumF3qxIJFReaqzng/DXxMIm4FHv35Lv2HCJ4JViEwLysyahqlbuFkrRhZ4Yrkikebp+WTvH6aRIFZq+DVBiDdIuOCNTSHdOUdVuGJmqgYYOgwnU7KxGtlNBtRAedC/GbgNLhWqV/69l7o9EmuZJSBHhiFNQzXytt79uUFPeGEYwf9uH9oHAs71fmiHfzx75CTKr2PNnP1trgncsmHc2IaMgMrZUmpOeLF9oqpmIebC+mlvO8uPUC/z5G5Tj7Q==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YWadlk7dlDPS8FE/zbkpAw07OxGTEss6pP/kiy/PtSidz+j63NTeNl5AsZ1VW8Z77FjbB7T9XyfHlcD3q8+PjaAa1la7KOlZMKq++IsX2zENdCFdiiRspKhSK+L96vcBI7mQTcekcw0O/30Ht6E+nhEigQpy6s5zvh6qNoUxFO45vZkmqlH9J6midGywCaXn/BcM/TUtFUlOHlcb3Brl/JeeZAEqLjS4qo/NSjkRL+V2dU8sfbuq55y/y1klvPA2SlJeZp+gP9Hil1tzQ5D8ZNojGC2YQwQHogfPTjnEtyuuz6jBiwJiWPt0tS4PXGy9E6DwUyhmsYLAJ6A4pFnqYQ==
- Original-authentication-results: spf=none (sender IP is ) smtp.mailfrom=Szabolcs dot Nagy at arm dot com;
- References: <486309d08583ed1c27a001d946205850b421f7ad.camel@marvell.com> <53b36206-3f07-432b-9d0f-02520debe4b8@gmail.com> <d96c9e5d-18f6-9c55-cd49-334c3d449a5b@redhat.com> <2e5c0137-4109-e7ce-8d1d-9c268e086f81@gmail.com> <f67a431b-0d15-644a-c5cd-8cf2ccf8e270@redhat.com> <87ef126bvu.fsf@oldenburg2.str.redhat.com> <ba965603-cc2a-3c53-4a1b-9edaf356f283@arm.com> <87mufq4og4.fsf@oldenburg2.str.redhat.com>
On 30/08/2019 17:18, Florian Weimer wrote:
>
> localedef: Use initializer for flexible array member [BZ #24950]
>
i would mention that you put the struct in .rodata,
that is a non-obvious change.
i'm fine with using gcc extension for the initializer.
i think the union solution is a bit safer though.
either way, it would be nice to fix this build error.
> 2019-08-30 Florian Weimer <fweimer@redhat.com>
>
> [BZ #24950]
> * locale/programs/charmap.h (struct charseq): Turn bytes into a
> flexible array member.
> * locale/programs/ld-ctype.c (ctype_finish): Use initializer for
> replace.
>
> diff --git a/locale/programs/charmap.h b/locale/programs/charmap.h
> index 870a9e9577..70db330d29 100644
> --- a/locale/programs/charmap.h
> +++ b/locale/programs/charmap.h
> @@ -60,7 +60,7 @@ struct charseq
> const char *name;
> uint32_t ucs4;
> int nbytes;
> - unsigned char bytes[0];
> + unsigned char bytes[];
> };
>
>
> diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
> index cfc9c43fd5..9123f64a56 100644
> --- a/locale/programs/ld-ctype.c
> +++ b/locale/programs/ld-ctype.c
> @@ -842,8 +842,6 @@ no input digits defined and none of the standard names in the charmap"));
> for (cnt = 0; cnt < 10; ++cnt)
> if (ctype->mboutdigits[cnt] == NULL)
> {
> - static struct charseq replace[2];
> -
> if (!warned)
> {
> record_error (0, 0, _("\
> @@ -851,10 +849,12 @@ not all characters used in `outdigit' are available in the charmap"));
> warned = 1;
> }
>
> - replace[0].nbytes = 1;
> - replace[0].bytes[0] = '?';
> - replace[0].bytes[1] = '\0';
> - ctype->mboutdigits[cnt] = &replace[0];
> + static const struct charseq replace =
> + {
> + .nbytes = 1,
> + .bytes = "?",
> + };
> + ctype->mboutdigits[cnt] = (struct charseq *) &replace;
> }
>
> warned = 0;
>