This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

strange behaviour powl


Dear all,

I try to compile the following two programs on my recent cygwin/XP with gcc 3.4.4:

PROGRAM A:
---------------------------
#include <math.h>

long double F(long double K){ return(powl(K,K)); }

main()
{
printf("%Lf \n",F(3.));
}
---------------------------

PROGRAM B:
---------------------------
#include <math.h>

long double F(long double K){ return(powl(K,1)); }

main()
{
printf("%Lf \n",F(3.));
}
---------------------------

Note that the only difference is "1" instead of "K" on line 3.
I compile by following command:

gcc blan.c -lm

In case A the answer of gcc is
/cygdrive/c/Temp/ccEHzDhs.o:blan.c:(.text+0x30): undefined reference to `_powl'
collect2: ld gaf exit-status 1 terug


In case B the program compiles without any problem and returns correct
answer when run. Both programs compile when substituting "pow" for "powl". The switch "-lm" makes no difference(!), the result is exactly
the same without it.


I must say this is a puzzle for me. Especially as the "nm libm.a | grep pow" in my /lib and /usr/lib says
00000000 T __f_pow
00000000 I __imp___f_pow
00000000 T __f_powf
00000000 I __imp___f_powf
00000000 I __imp__pow
00000000 T _pow
00000000 I __imp__powf
00000000 T _powf


indicating that (strangely) there isn't any powl in my libm !?

Can anybody tell me what could be going on ?

Thanks,
David


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]