This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Latest GCC fails to build glibc


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]