X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org To: cygwin AT cygwin DOT com From: Hans Horn Subject: Re: status of gcc4 -ffast-math Date: Thu, 05 Nov 2009 15:00:57 -0800 Lines: 105 Message-ID: References: <4AF3520B DOT 60803 AT gmail DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) In-Reply-To: X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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 >>> >>> int main (int argc, const char **argv) >>> { >>> >>> float f = atof (argv[1]); >>> double d = log (f); >>> return exp (f); >>> } >>> >>> >>> admin AT ubik /tmp/math >>> $ gcc-4 math.c -o math >>> >>> admin AT ubik /tmp/math >>> $ gcc-4 math.c -o math -ffast-math >>> >>> admin AT ubik /tmp/math >>> $ gcc-4 math.c -o math -ffast-math -O2 >>> >>> admin AT ubik /tmp/math >>> $ gcc-4 math.c -o math -ffast-math -O3 >>> >>> admin AT 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