[Bug bootstrap/56703] New: problems with strsignal and maybe strstr due to varying const on return type
jay.krell at cornell dot edu
gcc-bugzilla@gcc.gnu.org
Sat Mar 23 23:06:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56703
Bug #: 56703
Summary: problems with strsignal and maybe strstr due to
varying const on return type
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: bootstrap
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: jay.krell@cornell.edu
The autoconf checks for strsignal and maybe strstr are overly strict or wrong
and fail due to varying const on the return.
gcc 4.8.0
uname -a
SunOS unstable10s 5.10 Generic_147440-27 sun4v sparc
SUNW,SPARC-Enterprise-T5220
make[3]: Entering directory `/home/jkrell/obj/gcc480-sparc-sun-solaris2.10/gcc'
/home/jkrell/obj/gcc480-sparc-sun-solaris2.10/./prev-gcc/xg++
-B/home/jkrell/obj/gcc480-sparc-sun-solaris2.10/./prev-gcc/
-B/home/jkrell/gcc480-sparc-sun-solaris2.10/sparc-sun-solaris2.10/bin/
-nostdinc++
-B/home/jkrell/obj/gcc480-sparc-sun-solaris2.10/prev-sparc-sun-solaris2.10/libstdc++-v3/src/.libs
-B/home/jkrell/obj/gcc480-sparc-sun-solaris2.10/prev-sparc-sun-solaris2.10/libstdc++-v3/libsupc++/.libs
-I/home/jkrell/obj/gcc480-sparc-sun-solaris2.10/prev-sparc-sun-solaris2.10/libstdc++-v3/include/sparc-sun-solaris2.10
-I/home/jkrell/obj/gcc480-sparc-sun-solaris2.10/prev-sparc-sun-solaris2.10/libstdc++-v3/include
-I/home/jkrell/src/gcc-4.8.0/libstdc++-v3/libsupc++
-L/home/jkrell/obj/gcc480-sparc-sun-solaris2.10/prev-sparc-sun-solaris2.10/libstdc++-v3/src/.libs
-L/home/jkrell/obj/gcc480-sparc-sun-solaris2.10/prev-sparc-sun-solaris2.10/libstdc++-v3/libsupc++/.libs
-c -g -O2 -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables
-W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute
-pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings
-DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I/home/jkrell/src/gcc-4.8.0/gcc
-I/home/jkrell/src/gcc-4.8.0/gcc/build
-I/home/jkrell/src/gcc-4.8.0/gcc/../include -I./../intl
-I/home/jkrell/src/gcc-4.8.0/gcc/../libcpp/include
-I/home/jkrell/src/gcc-4.8.0/gcc/../libdecnumber
-I/home/jkrell/src/gcc-4.8.0/gcc/../libdecnumber/dpd -I../libdecnumber
-I/home/jkrell/src/gcc-4.8.0/gcc/../libbacktrace \
-o build/genconstants.o /home/jkrell/src/gcc-4.8.0/gcc/genconstants.c
In file included from ./bconfig.h:3:0,
from /home/jkrell/src/gcc-4.8.0/gcc/genconstants.c:27:
./auto-host.h:1994:16: error: declaration does not declare anything
[-fpermissive]
#define rlim_t long
^
In file included from /home/jkrell/src/gcc-4.8.0/gcc/genconstants.c:28:0:
/home/jkrell/src/gcc-4.8.0/gcc/system.h:448:48: error: 'char* strstr(const
char*, const char*)' conflicts with previous using declaration 'const char*
std::strstr(const char*, const char*)'
extern char *strstr (const char *, const char *);
^
In file included from /home/jkrell/src/gcc-4.8.0/gcc/genconstants.c:28:0:
/home/jkrell/src/gcc-4.8.0/gcc/system.h:500:34: error: declaration of C
function 'const char* strsignal(int)' conflicts with
extern const char *strsignal (int);
^
In file included from
/home/jkrell/obj/gcc480-sparc-sun-solaris2.10/prev-sparc-sun-solaris2.10/libstdc++-v3/include/cstring:42:0,
from /home/jkrell/src/gcc-4.8.0/gcc/system.h:205,
from /home/jkrell/src/gcc-4.8.0/gcc/genconstants.c:28:
/usr/include/string.h:79:14: error: previous declaration 'char* strsignal(int)'
here
extern char *strsignal(int);
^
gmake[3]: *** [build/genconstants.o] Error 1
gmake[3]: Leaving directory `/home/jkrell/obj/gcc480-sparc-sun-solaris2.10/gcc'
gmake[2]: *** [all-stage2-gcc] Error 2
gmake[2]: Leaving directory `/home/jkrell/obj/gcc480-sparc-sun-solaris2.10'
gmake[1]: *** [stage2-bubble] Error 2
gmake[1]: Leaving directory `/home/jkrell/obj/gcc480-sparc-sun-solaris2.10'
gmake: *** [all] Error 2
jkrell@unstable10s [unstable10s]:~/obj/gcc480-sparc-sun-solaris2.10 >
Both the strstr and strsignal declarations in system.h have autoconf #if's
around them.
One wonders why they evaluate to true.
krell@unstable10s [unstable10s]:~/obj/gcc480-sparc-sun-solaris2.10 > grep STRS
*/*h
gcc/auto-host.h:#define HAVE_DECL_STRSIGNAL 0
gcc/auto-host.h:#define HAVE_DECL_STRSTR 0
gcc/auto-host.h:#define HAVE_STRSIGNAL 1
libiberty/config.h:#define HAVE_STRSIGNAL 1
libiberty/config.h:#define HAVE_STRSTR 1
prev-gcc/auto-host.h:#define HAVE_DECL_STRSIGNAL 1
prev-gcc/auto-host.h:#define HAVE_DECL_STRSTR 1
prev-gcc/auto-host.h:#define HAVE_STRSIGNAL 1
The mystery deepens...
cd gcc
vi config.log
...
| #undef HAVE_DECL_STRSIGNAL
| #define HAVE_DECL_STRSIGNAL 1
|
| #include "ansidecl.h"
| #include "system.h"
|
| int
| main ()
| {
| #ifndef strsignal
| char *(*pfn) = (char *(*)) strsignal ;
| #endif
| ;
| return 0;
| }
configure:10374: result: no
configure:10336: checking whether strstr is declared
configure:10359: /home/jkrell/obj/gcc480-sparc-sun-solaris2.10/./prev-gcc/xgcc
-B/home/jkrell/obj/gcc4
80-sparc-sun-solaris2.10/./prev-gcc/
-B/home/jkrell/gcc480-sparc-sun-solaris2.10/sparc-sun-solaris2.10/
bin/ -B/home/jkrell/gcc480-sparc-sun-solaris2.10/sparc-sun-solaris2.10/bin/
-B/home/jkrell/gcc480-sparc
-sun-solaris2.10/sparc-sun-solaris2.10/lib/ -isystem
/home/jkrell/gcc480-sparc-sun-solaris2.10/sparc-su
n-solaris2.10/include -isystem
/home/jkrell/gcc480-sparc-sun-solaris2.10/sparc-sun-solaris2.10/sys-incl
ude -c -g -O2 -I/home/jkrell/src/gcc-4.8.0/gcc
-I/home/jkrell/src/gcc-4.8.0/gcc/../include conftes
t.c >&5
In file included from conftest.c:116:0:
/home/jkrell/src/gcc-4.8.0/gcc/system.h:500:20: error: conflicting types for
'strsignal'
extern const char *strsignal (int);
^
In file included from /home/jkrell/src/gcc-4.8.0/gcc/system.h:213:0,
from conftest.c:116:
/usr/include/string.h:79:14: note: previous declaration of 'strsignal' was here
extern char *strsignal(int);
^
In file included from conftest.c:116:0:
/home/jkrell/src/gcc-4.8.0/gcc/system.h:641:17: fatal error: gmp.h: No such
file or directory
#include <gmp.h>
^
compilation terminated.
configure:10359: $? = 1
configure: failed program was:
so the checks for strstr and strsignal are too strict.
How about more like:
const char* a = strsignal(1);
on the matter of conflicting declarations:
conftest.c:77:6: warning: conflicting types for built-in function 'ldexp'
[enabled by default]
char ldexp ();
conftest.c:109:6: warning: conflicting types for built-in function
'fprintf_unlocked' [enabled by defau
lt]
char fprintf_unlocked ();
^
Undefined first referenced
symbol in file
fprintf_unlocked /home/jkrell/tmp/cc2gUNar.o
ld: fatal: symbol referencing errors. No output written to conftest
conftest.c:109:6: warning: conflicting types for built-in function
'fputc_unlocked' [enabled by default
]
char fputc_unlocked ();
^
Undefined first referenced
symbol in file
fputc_unlocked /home/jkrell/tmp/ccenrM6Q.o
more for *_unlocked, fork but I guess all that is ok..
I'm confused about strstr.
strsignal is definitely a problem, due to const mismatch on the return type.
More information about the Gcc-bugs
mailing list