This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: other/8974: fabs error with -ansi
- From: Warren du Plessis <warren at eng dot up dot ac dot za>
- To: bangerth at dealii dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, warren at eng dot up dot ac dot za, gcc-gnats at gcc dot gnu dot org
- Date: Mon, 23 Dec 2002 12:25:15 +0000
- Subject: Re: other/8974: fabs error with -ansi
- References: <20021221033738.16429.qmail@sources.redhat.com>
Hi,
If I try to link with "-static -ansi -lm" I get the following error message:
/tmp/cc6IBIGC.o: In function `main':
/tmp/cc6IBIGC.o(.text+0x43): undefined reference to `fabs'
/tmp/cc6IBIGC.o(.text+0x89): undefined reference to `fabs'
/tmp/cc6IBIGC.o(.text+0xca): undefined reference to `fabs'
collect2: ld returned 1 exit status
If I remove the -ansi flag and compile with "-static -lm" everything
works perfectly as I explained previously.
I tried compiling with -O through -O8 (just to make sure! - I know the
docs say that there is nothing above -O3, but a friend of mine says that
it goes up to -O5 or -O6 at least) and got exactly the same results.
My friend says that it could be a typecasting problem if that helps.
Thanks for your help!
Warren
bangerth@dealii.org wrote:
Synopsis: fabs error with -ansi
State-Changed-From-To: open->feedback
State-Changed-By: bangerth
State-Changed-When: Fri Dec 20 19:37:38 2002
State-Changed-Why:
The problem you write seems as if for certain numbers the
implementation of fabs is doing something wrong, but only
on certain machines. Now, fabs is a function that libm
implements, not the compiler, so to find out where the
problem lies exactly, try the following:
- try linking with -static on a machine where it works.
This makes sure that not the local libm is taken, but the
one from the system where it works. Try the other way
round and see whether it then also fails on the machines
it worked on previously.
- Try what happens when you switch on optimization.
Just for the reference, I cannot reproduce the problem
on a PIII, but that was to be expected from your report.
Thanks
Wolfgang
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8974