This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] [BZ #15381] Initialize wide struct info.
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: OndÅej BÃlka <neleai at seznam dot cz>
- Cc: Julius Plenz <julius at plenz dot com>, Andreas Schwab <schwab at suse dot de>, libc-alpha at sourceware dot org
- Date: Tue, 14 May 2013 10:27:34 -0400
- Subject: Re: [PATCH] [BZ #15381] Initialize wide struct info.
- References: <mvmmwryyq0g dot fsf at hawking dot suse dot de> <20130514115913 dot GF20282 at plenz dot com> <20130514123120 dot GA18821 at domone dot kolej dot mff dot cuni dot cz>
On 05/14/2013 08:31 AM, OndÅej BÃlka wrote:
> On Tue, May 14, 2013 at 01:59:13PM +0200, Julius Plenz wrote:
>> Hi,
>>
>> * Andreas Schwab <schwab@suse.de>:
>>>> Are you opposed to initializing _wide_data to NULL?
>>>
>>> I would prefer -1 so that broken uses crash predictably. :-)
>>
>> Since undefined behaviour can be anything you like, both initializing
>> with NULL and with -1 is equally "valid".
>>
> OK, here is version with -1 (or 0xdeadbeef if you like it more)
>
> ---
> libio/genops.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/libio/genops.c b/libio/genops.c
> index 390d8d2..18039aa 100644
> --- a/libio/genops.c
> +++ b/libio/genops.c
> @@ -643,6 +643,7 @@ _IO_no_init (fp, flags, orientation, wd, jmp)
> {
> _IO_old_init (fp, flags);
> fp->_mode = orientation;
> + fp->_wide_data = (void *) -1;
> #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
> if (orientation >= 0)
> {
>
OK to checkin with ChangeLog, and NEWS update for BZ.
Cheers,
Carlos.