When building frysk without --enable-coverage (compilation and link options
include -g -O), funit-scopes.c compiles and links correctly.
When building frysk with --enable-coverage (compilation and link options include
-g --coverage --O0), funit-scopes.c compiles correctly, but fails to link with
the following error:
-I/home/aedil/build_farm/frysk_gcov/frysk_config/frysk-core -I. -fPIC
-fasynchronous-unwind-tables -g --coverage -O0 -Wall -Werror -o
frysk/pkglibdir/funit-scopes.o: In function `first':
undefined reference to `second'
collect2: ld returned 1 exit status
make: *** [frysk/pkglibdir/funit-scopes] Error 1
This is happening on FC6, both on i386 and x86_64.
Gcc version is gcc version 4.1.1 20070105 (Red Hat 4.1.1-51).
The only change between a previous successful build of frysk and the current
failures (as far as this file is concerned) is the actual content of the source
code file (same GCC versions etc).
Investigating this problem a bit further, but it seems to be a bug in gcc.
Working on a workaround for the time being...
2007-07-03 Kris Van Hees <firstname.lastname@example.org>
* funit-scopes.c: Removed 'extern' declaration on second() to work
around a GCC bug that surfaces when compiling/linking with -O0.
Is there an upstream bug number; and a test in frysk-imports/tests/frysk4725/?
The GCC bug report was in the process of being filed...
GCC bug report is: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32615
There is no test case and there is also no need to add one because it is not
actually a bug in GCC but rather a misinterpretation of 'extern inline' by the
original author of the funit-scopes.c class, as explained by Andrew Pinski:
extern inline is not what you think it is. The "extern inline" GNU C90
implementes (except for 4.3 with -std=c99/-std=gnu99 which is the standard C99
extern inline) means the function is extern but don't create a definition if
the function was not inlined. This is different from C99's extern inline.