This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Fix aliasing violation tst-rec-dlopen
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: Zack Weinberg <zackw at panix dot com>, Pedro Alves <palves at redhat dot com>
- Cc: Florian Weimer <fweimer at redhat dot com>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Tue, 15 Dec 2015 11:40:55 -0500
- Subject: Re: [PATCH] Fix aliasing violation tst-rec-dlopen
- Authentication-results: sourceware.org; auth=none
- References: <566FE225 dot 8020208 at redhat dot com> <56702B7D dot 4040109 at redhat dot com> <20151215150434 dot GU11489 at vapier dot lan> <56702E3E dot 4050405 at redhat dot com> <CAKCAbMjJw1-JDMA_KX08+Q3A4hvYWbGXsqk2jGkUVOYz=uzLYQ at mail dot gmail dot com>
On 12/15/2015 10:30 AM, Zack Weinberg wrote:
> POSIX assumes an architecture where object and function pointers
> are interconvertible, and ...
>
>> The 2013 Technical Corrigendum to POSIX.1-2008 (a.k.a.
>> POSIX.1-2013) improved matters by requiring that conforming
>> implementations support casting 'void *' to a function pointer.
>
> ... that was the correct thing for them to do, and the right way to write
> this program is just to use a cast.
I wrote the code in question, and I did what was historically considered
best practice, old habits die hard.
If new compilers complain then we should absolutely switch to and encourage
correct casting of function pointers to their appropriate types. It's the
only thing that makes sense.
Cheers,
Carlos.