This causes good old K&R code with redundant prototypes to miscompile: cknfs.c:184: macro `strchr' used without args These functions need to be inlined instead. Workaround: Compile with -g rather than -O.
It's in the glibc FAQ: 3.8. I've got errors compiling code that uses certain string functions. Why? {AJ} glibc 2.1 has special string functions that are faster than the normal library functions. Some of the functions are additionally implemented as inline functions and others as macros. This might lead to problems with existing codes but it is explicitly allowed by ISO C. The optimized string functions are only used when compiling with optimizations (-O1 or higher). The behavior can be changed with two feature macros: * __NO_STRING_INLINES: Don't do any string optimizations. * __USE_STRING_INLINES: Use assembly language inline functions (might increase code size dramatically). Since some of these string functions are now additionally defined as macros, code like "char *strncpy();" doesn't work anymore (and is unnecessary, since <string.h> has the necessary declarations). Either change your code or define __NO_STRING_INLINES. {UD} Another problem in this area is that gcc still has problems on machines with very few registers (e.g., ix86). The inline assembler code can require almost all the registers and the register allocator cannot always handle this situation. One can disable the string optimizations selectively. Instead of writing cp = strcpy (foo, "lkj"); one can write cp = (strcpy) (foo, "lkj"); This disables the optimization for that specific call.