[patch] -O2 -fno-inline makes system headers fail

Thomas Braxton brax108 at cox.net
Sun Feb 5 22:50:09 GMT 2006


On Sunday 05 February 2006 16:32, Leo Savernik wrote:
> Hello,
>
> I've detected the following nasty bug which makes <string.h> emit spurious
> symbols not actually meant to be emitted when -fno-inline is used in
> combination with -O2.
>
> I've written a KDE/3.5/kde-common/admin/acinclude.m4.in patch that copes
> with that situation. On my system, it correctly fails. However, on gcc >=
> 3.x systems, it should *not* fail. As I currently cannot test this, I
> provide the patch on this list for unwary testers.
>
> Just apply this patch to your kdelibs's/kdebase's/whatever acinclude.m4.in
> and call ./configure --enable-debug=yes and look out for a line
>
> checking whether system headers can cope with -O2 -fno-inline... yes
>
> and post an answer containing your result along with your compiler version.
>
> Thank you.
>
> mfg
> 	Leo
gcc (GCC) 4.0.1

configure:5588: checking whether system headers can cope with -O2 -fno-inline
configure:5627: gcc -c -std=iso9899:1990 -W -Wall -Wchar-subscripts -Wshadow 
-Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE=500 
-D_BSD_SOURCE -g -O2 -fno-schedule-insns -fno-inline   -Wformat-security 
-Wmissing-format-attribute -fno-reorder-blocks -D_USE_GNU  conftest.c >&5
conftest.c: In function 'main':
conftest.c:22: error: '__built' undeclared (first use in this function)
conftest.c:22: error: (Each undeclared identifier is reported only once
conftest.c:22: error: for each function it appears in.)
conftest.c:22: error: syntax error before 'in_constant_p'
conftest.c:25: error: '__c' undeclared (first use in this function)
conftest.c:25: error: syntax error before 'onst'
conftest.c:25: warning: left-hand operand of comma expression has no effect
conftest.c:26: error: '__builtin_cons' undeclared (first use in this function)
conftest.c:26: error: syntax error before 'tant_p'
conftest.c:26: warning: implicit declaration of function '__rawmemchr'
conftest.c:27: error: syntax error before ')' token
conftest.c:27: error: syntax error before ')' token
conftest.c:21: warning: unused variable '__a2'
conftest.c:30: error: void value not ignored as it ought to be
configure:5633: $? = 1
configure: failed program was:
| /* confdefs.h.  */
|
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE "kdebase"
| #define VERSION "3.5.1"
| #ifdef __cplusplus
| extern "C" void std::exit (int) throw (); using std::exit;
| #endif
| /* end confdefs.h.  */
|
|   #include <string.h>
|
| int
| main ()
| {
|   const char *pt, *et;
|   et = __extension__      ({ char __a0, __a1, __a2;       (__built
| in_constant_p (  ";,"  ) && ((size_t)(const void *)((   ";,"   ) + 1) - 
(size_t)
| (const void *)(   ";,"   ) == 1)        ? ((__a0 = ((__const char  *) 
(  ";,"  )
| )[0], __a0 == '\0')     ? ((void) (  pt ), ((void *)0) )        : ((__a1 = 
((__c
| onst char *) (  ";,"  ))[1], __a1 == '\0')      ? (__extension__ 
(__builtin_cons
| tant_p (  __a0 ) && (  __a0 ) == '\0'   ? (char *) __rawmemchr (   pt  ,   
__a0
| )       : strchr (   pt  ,   __a0 )))   : ((__a2 = ((__const char *) 
(  ";,"  ))
| [2], __a2 == '\0')      ? __strpbrk_c2 (  pt , __a0, __a1)      : (((__const 
cha
| r *) (  ";,"  ))[3] == '\0'     ? __strpbrk_c3 (  pt , __a0, __a1, __a2)
| : strpbrk (  pt ,   ";,"  ))))) : strpbrk (  pt ,   ";,"  )); }) ;
|
|   ;
|   return 0;
| }
configure:5661: result: no

run on kdebase 3.5 svn current

Thomas




More information about the kde-core-devel mailing list