Hans Horn wrote:
Dave Korn wrote:
Hans Horn wrote:
Folks,

what is the current status of -ffast-math for gcc4 under cygwin.

I tried to use it for some numerical C code and get the following link
errors:

eval.o:eval.c:(.text+0x79c): undefined reference to `_f_pow'
eval.o:eval.c:(.text+0x7d8): undefined reference to `_f_log'
eval.o:eval.c:(.text+0x7f0): undefined reference to `_f_exp'

  WJFFM:

$ cat math.c

#include <math.h>

int main (int argc, const char **argv)
{

  float f = atof (argv[1]);
  double d = log (f);
  return exp (f);
}


ad...@ubik /tmp/math
$ gcc-4 math.c -o math

ad...@ubik /tmp/math
$ gcc-4 math.c -o math -ffast-math

ad...@ubik /tmp/math
$ gcc-4 math.c -o math -ffast-math -O2

ad...@ubik /tmp/math
$ gcc-4 math.c -o math -ffast-math -O3

ad...@ubik /tmp/math
$

Perhaps a few more details about what you're doing, a simple reproducible testcase, what kind of command-lines you're using, etc. etc... might help.

    cheers,
      DaveK

Dave,

I was just shooting into the dark expecting more like a yes/no wrt use of -ffast-math. Thx for responding!

I'm linking with gfortran (v4.5 or v4.3.4) (because the C code calls a lot of fortran under the hood).

This is how I compile & link:

gcc-4 -c -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE -D_POSIX_SOURCE \ -std=c99 -Wall -Wshadow -Wreturn-type -Wunused \ -Wuninitialized -Wformat -Wunused-function -Wunused-macros -Wunused-label -Wredundant-decls -fno-leading-underscore -O3 \ -fno-strict-aliasing -Winline -fexpensive-optimizations \ -finline-functions -finline-limit=500000 -fstrength-reduce -fgcse \
-fgcse-lm -fgcse-sm -funroll-loops -fforce-addr -fomit-frame-pointer \
-ftree-vectorize -mfpmath=sse -msse3 -ffast-math \
-march=pentium4 -pipe -fbounds-check -Wextra -Winit-self  \
-DYY_NO_UNISTD_H -o math.o math.c

gfortran -O3 -fno-strict-aliasing -Winline -fexpensive-optimizations \
-finline-functions -finline-limit=500000 \
-fstrength-reduce -fgcse -fgcse-lm -fgcse-sm -funroll-loops -fforce-addr -fomit-frame-pointer -ftree-vectorize -mfpmath=sse \ -msse3 -ffast-math -march=pentium4 -pipe -L. -o math.exe math.o -Xlinker -\( -O3 -fno-strict-aliasing -Winline -fexpensive-optimizations \ -finline-functions -finline-limit=500000 -fstrength-reduce -fgcse -fgcse-lm -fgcse-sm -funroll-loops -fforce-addr -fomit-frame-pointer \ -ftree-vectorize -mfpmath=sse -msse3 -ffast-math -march=pentium4 -pipe -lm -lgsl -ly -lfl --enable-auto-import -Xlinker -\)

Compiling/linking your example gives:

math.c: In function ‘main’:
math.c:4: warning: implicit declaration of function ‘atof’
math.c:5: warning: unused variable ‘d’
math.c:3: warning: unused parameter ‘argc’
math.o:math.c:(.text+0x30): undefined reference to `_f_exp'
collect2: ld returned 1 exit status

Do you where this gobble stuff ‘ comes from, btw?

H.


Dave,

I just found the culprit!
It's -fno-leading-underscore.
Have to see whether I can live without it!

Thx. again


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply via email to