https://gcc.gnu.org/bugzilla/show_bug.cgi?id=23087
Keith Thompson <Keith.S.Thompson at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|4.0.0 |5.3.0
--- Comment #13 from Keith Thompson <Keith.S.Thompson at gmail dot com> ---
This problem still exists in gcc 5.3.0.
Here's a perhaps clearer example that doesn't depend on string literals,
and that demonstrates the problem both when plain char is signed
and when it's unsigned.
$ cat tmp.c
#include <limits.h>
void foo(void) {
char *pc = 0;
#if CHAR_MIN < 0
/* plain char is signed but incompatible with signed char */
signed char *psc = pc;
#else
/* plain char is unsigned but incompatible with unsigned char */
unsigned char *puc = pc;
#endif
}
$ gcc --version
gcc (GCC) 5.3.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ gcc -std=c11 -pedantic-errors -c tmp.c
tmp.c: In function 'foo':
tmp.c:6:24: error: pointer targets in initialization differ in signedness
[-Wpointer-sign]
signed char *psc = pc;
^
$ gcc -std=c11 -pedantic-errors -c -funsigned-char tmp.c
tmp.c: In function 'foo':
tmp.c:9:26: error: pointer targets in initialization differ in signedness
[-Wpointer-sign]
unsigned char *puc = pc;
^
$