optimization breaks atanh call (C on x86 GNU/Linux)

Theodore Hong twh1@doc.ic.ac.uk
Tue Feb 8 06:28:00 GMT 2000


Hi-

When I try to compile a call to atanh using -O1, the linker crashes
with the complaint, "undefined reference to `__log1p'".  However, if I
turn off optimization, it compiles and runs fine.  I think my math
library should be ok, because I can call log1p by itself just fine.

gcc output follows, .i file attached.  This version of gcc came from
the vanilla gcc-2.7.2.3-8 RPM distributed with RedHat Linux 5.0.

thanks!
theo

-- 
PGP: http://longitude.doc.ic.ac.uk/~twh1/ 
D5E5 0237 0592 CAF6 E4C4 967F 457E 9583 6AB4 876B


---------------------------------------------------------------------------
longitude.doc.ic.ac.uk% uname -a
Linux longitude.doc.ic.ac.uk 2.0.32 #13 Fri Mar 20 17:24:53 GMT 1998 i686 unknown
longitude.doc.ic.ac.uk% cat /etc/redhat-release 
release 5.0 (Hurricane)


longitude.doc.ic.ac.uk% gcc -v -save-temps -O1 -lm -o buggy buggy.c
Reading specs from /usr/lib/gcc-lib/i686-unknown-linux/2.7.2.3/specs
gcc version 2.7.2.3
 /usr/lib/gcc-lib/i686-unknown-linux/2.7.2.3/cpp -lang-c -v -undef
-D__GNUC__=2 -D__GNUC_MINOR__=7 -D__ELF__ -Dunix -Di386 -Dlinux
-D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__i386
-D__linux -Asystem(unix) -Asystem(posix) -Acpu(i386) -Amachine(i386)
-D__OPTIMIZE__ buggy.c buggy.i
GNU CPP version 2.7.2.3 (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/i686-unknown-linux/include
 /usr/lib/gcc-lib/i686-unknown-linux/2.7.2.3/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i686-unknown-linux/2.7.2.3/cc1 buggy.i -quiet -dumpbase buggy.c -O1 -version -o buggy.s
GNU C version 2.7.2.3 (i386 Linux/ELF) compiled by GNU C version 2.7.2.3.
 as -V -Qy -o buggy.o buggy.s
GNU assembler version 2.9.1 (i386-redhat-linux), using BFD version 2.9.1.0.23
 ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o buggy -o buggy /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/gcc-lib/i686-unknown-linux/2.7.2.3/crtbegin.o -L/usr/lib/gcc-lib/i686-unknown-linux/2.7.2.3 -lm buggy.o -lgcc -lc -lgcc /usr/lib/gcc-lib/i686-unknown-linux/2.7.2.3/crtend.o /usr/lib/crtn.o
buggy.o: In function `main':
buggy.o(.text+0x6a): undefined reference to `__log1p'

-------------- next part --------------
A non-text attachment was scrubbed...
Name: buggy.i.gz
Type: application/x-gzip
Size: 5931 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-bugs/attachments/20000208/34a705c0/attachment.bin>


More information about the Gcc-bugs mailing list