This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Latest GCC fails to build glibc
- From: Florian Weimer <fweimer at redhat dot com>
- To: "Carlos O'Donell" <carlos at redhat dot com>, sellcey at imgtec dot com
- Cc: libc-alpha at sourceware dot org
- Date: Fri, 22 May 2015 12:05:10 +0200
- Subject: Re: Latest GCC fails to build glibc
- Authentication-results: sourceware.org; auth=none
- References: <24211622-19d7-4514-be3c-337c241188d2 at BAMAIL02 dot ba dot imgtec dot org> <5559D484 dot 8090002 at redhat dot com> <1432135872 dot 16668 dot 72 dot camel at ubuntu-sellcey> <555CB03F dot 6010909 at redhat dot com>
On 05/20/2015 06:03 PM, Carlos O'Donell wrote:
> On 05/20/2015 11:31 AM, Steve Ellcey wrote:
>> On Mon, 2015-05-18 at 14:01 +0200, Florian Weimer wrote:
>>
>>>>
>>>> In file included from memstream.c:18:0:
>>>> memstream.c: In function 'open_memstream':
>>>> memstream.c:92:22: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
>>>> _IO_JUMPS ((struct _IO_FILE_plus *) &new_f->fp._sf._sbf) = &_IO_mem_jumps;
>>>
>>> Steve, could you try the attached patch, please?
>>>
>>> An alternative fix for some of these issues would be to use the
>>> cast-free member access where the type of the outer object is known from
>>> context, getting rid of _IO_JUMPS.
>>
>> Does anyone else have any comments on Florian's patch to get rid of the
>> strict-warning errors from the libio directory? I compiled it and
>> verified that it worked for me but I don't really feel comfortable
>> approving the patch as I am not very familiar with the code in this
>> directory and am not sure how others feel about this particular approach
>> to getting rid of the errors.
>
> Florian's patch looks good to me.
>
> The offsetof trick is one way around the strict aliasing violation.
>
> In this case it works well.
Thanks, committed.
--
Florian Weimer / Red Hat Product Security