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: "Carlos O'Donell" <carlos at redhat dot com>
- To: sellcey at imgtec dot com, Florian Weimer <fweimer at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Wed, 20 May 2015 12:03:11 -0400
- 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>
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.
Cheers,
Carlos.