undefined reference to `__isnanf'

【from:http://sourceforge.net/p/mingw/bugs/2192/】

I was migrating from cygwingcc to mingw gcc and got a linkage issue

/cygdrive/c/stuff/ChibiOS_2.6.0/demos/Win32-MinGW/main.c:70: undefined reference to `__isnanf'
collect2: error: ld returned 1 exit status

I was not expecting this since the project does compile under cygwin, I have math.h included and I am referencing -lm library.

I've tracked this to -O0 flag: the issues does NOT happen if I use -O1 or -O2, but it does happen in case of -O0.

My versions are
Target: i686-pc-mingw32
Configured with: /usr/src/packages/mingw-gcc/32/mingw-gcc-4.7.3-1/src/gcc-4.7.3/configure --srcdir=/usr/src/packages/mingw-gcc/32/mingw-gcc-4.7.3-1/src/gcc-4.7.3 --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --datadir=/usr/share --localstatedir=/var --sysconfdir=/etc --datarootdir=/usr/share --docdir=/usr/share/doc/mingw-gcc -C --build=i686-pc-cygwin --host=i686-pc-cygwin --target=i686-pc-mingw32 --without-libiconv-prefix --without-libintl-prefix --with-sysroot=/usr/i686-pc-mingw32/sys-root --with-build-sysroot=/usr/i686-pc-mingw32/sys-root --enable-languages=c,c++,ada,fortran,objc,obj-c++ --disable-sjlj-exceptions --with-dwarf2 --enable-shared --enable-libgomp --disable-win32-registry --enable-libstdcxx-debug --disable-build-poststage1-with-cxx --enable-version-specific-runtime-libs --disable-multilib --enable-decimal-float=bid --disable-werror --enable-lto
Thread model: win32
gcc version 4.7.3 (GCC)

你可能感兴趣的:(undefined reference to `__isnanf')