This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH] detect incompatible aliases (PR c/81854)
- From: Steve Ellcey <sellcey at cavium dot com>
- To: Martin Sebor <msebor at gmail dot com>, Joseph Myers <joseph at codesourcery dot com>
- Cc: Gcc Patch List <gcc-patches at gcc dot gnu dot org>, Jonathan Wakely <jwakely at redhat dot com>, libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Wed, 20 Sep 2017 09:38:45 -0700
- Subject: Re: [PATCH] detect incompatible aliases (PR c/81854)
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Steve dot Ellcey at cavium dot com;
- References: <61673e8d-6f5c-9bc0-dcf8-75eee71f98de@gmail.com> <1505921857.2286.101.camel@cavium.com> <3d1bd511-dfe3-d965-248e-a2ec108187d5@gmail.com>
- Reply-to: sellcey at cavium dot com
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
On Wed, 2017-09-20 at 10:17 -0600, Martin Sebor wrote:
>
> The comment copied below from sysdeps/aarch64/multiarch/memmove.c
> suggests this might be deliberate:
>
> /* Redefine memmove so that the compiler won't complain about the
> type
> mismatch with the IFUNC selector in strong_alias, below. */
>
> so my guess is that the improved type checking has just exposed
> this mismatch. Can you please post the translation unit so we
> can confirm it?
>
> Thanks
> Martin
The translation unit is sysdeps/aarch64/multiarch/memmove.c. If I
preprocess that and cut out the unneeded parts I get:
extern int i;
typedef long unsigned int size_t;
extern void *__redirect_memmove (void *__dest, const void *__src,
size_t __n)
__attribute__ ((__nothrow__ )) ;
extern __typeof (__redirect_memmove) __libc_memmove;
extern __typeof (__redirect_memmove) __memmove_generic ;
extern __typeof (__redirect_memmove) __memmove_thunderx ;
extern __typeof (__libc_memmove) __libc_memmove;
__typeof (__libc_memmove) *__libc_memmove_ifunc (void) __asm__
("__libc_memmove");
__attribute__ ((__optimize__ ("-fno-stack-protector"))) __typeof
(__libc_memmove) *__libc_memmove_ifunc (void)
{
__typeof (__libc_memmove) *res = i ? __memmove_thunderx
: __memmove_generic; return res; }
__asm__ (".type " "__libc_memmove" ", %gnu_indirect_function");
extern __typeof (__libc_memmove) memmove __attribute__ ((alias
("__libc_memmove")));;
Which, when compiled gives me:
% install/bin/gcc -c x.c
x.c:15:34: warning: ‘memmove’ alias between functions of incompatible
types ‘void *(void *, const void *, size_t) {aka void *(void *, const
void *, long unsigned int)}’ and ‘void * (*(void))(void *, const void
*, size_t) {aka void * (*(void))(void *, const void *, long unsigned
int)}’ [-Wattributes]
extern __typeof (__libc_memmove) memmove __attribute__ ((alias
("__libc_memmove")));;
^~~~~~~
x.c:10:84: note: aliased declaration here
(__optimize__ ("-fno-stack-protector"))) __typeof (__libc_memmove)
*__libc_memmove_ifunc (void)
^~
~~~~~~~~~~~~~~~~~~