When I compile and run the following code in my debug build using GCC 4.0.1 on
an Intel Mac (OSX10.5) I find that the pow() function returns NaN whereas in
the release build it works as expected. When using the powf() function it works
as expected.

const float dBgain = -2.75750828f;
const double A = pow((float)10,(float)(dBgain/20.0)));

The command line used to compile the code is as follows:

CompileC "build/C2 Project XCode.build/Imported CodeWarrior Settings/C2 AU
Debug.build/Objects-normal/i386/CAFilterBiquad.o"
/Users/john/Documents/Dev/C2/Libraries/CAEffects/CAFilterBiquad.cpp normal i386
c++ com.apple.compilers.gcc.4_0
    cd /Users/john/Documents/Dev/C2
    /Developer/usr/bin/gcc-4.0 -x c++ -arch i386 -pipe -Wno-trigraphs
-fpascal-strings -fasm-blocks -gstabs+ -fno-eliminate-unused-debug-symbols -O0
-fwritable-strings -DDEBUG=1 -fmessage-length=0 -msse3
-fvisibility-inlines-hidden -mmacosx-version-min=10.4
"-I/Users/john/Documents/Dev/C2/build/C2 Project XCode.build/Imported
CodeWarrior Settings/C2 AU Debug.build/Alchemy.hmap" -Wmost
-Wno-four-char-constants -Wno-unknown-pragmas
"-F/Users/john/Documents/Dev/C2/build/Imported CodeWarrior Settings"
-F/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks
-F/Users/john/Documents/Dev/C2 -I/Developer/SDKs/MacOSX10.5.sdk/usr/lib
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/dtrace
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/i686-apple-darwin9
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/java
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/powerpc-apple-darwin9
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/samba
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/sqlite3
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/system
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/darwin
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin9
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/powerpc-apple-darwin9
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/i686-apple-darwin9/4.0.1
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/powerpc-apple-darwin9/4.0.1
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/samba/auth
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/samba/charset
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/samba/idmap
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/samba/nss_info
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/samba/pdb
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/samba/vfs
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/darwin/3.3
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/powerpc-apple-darwin9/4.0.1
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1/include
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1/install-tools
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1/x86_64
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/powerpc-apple-darwin9/4.0.1/include
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/powerpc-apple-darwin9/4.0.1/install-tools
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/powerpc-apple-darwin9/4.0.1/ppc64
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/c++
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/pexpert
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/root
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/X11
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1/install-tools/include
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/powerpc-apple-darwin9/4.0.1/include/c++
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/powerpc-apple-darwin9/4.0.1/install-tools/include
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/c++/4.0.0
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/root/usr
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/X11/Xtrans
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/powerpc-apple-darwin9/4.0.1/include/c++/4.0.0
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/root/usr/X11
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/root/usr/X11/include
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/root/usr/X11/include/X11
-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/root/usr/X11/include/X11/Xtrans
"-I/Users/john/Documents/Dev/C2/build/Imported CodeWarrior Settings/include"
-I/Developer/SDKs/MacOSX10.5.sdk/usr/include
-I/Developer/SDKs/MacOSX10.5.sdk/Developer/Headers/FlatCarbon
-ILibrary/CAAnalyser/Loris -ILibrary/CACore -ILibrary/CAGui -ILibrary/CAUtil
-ILibrary/CAEffects -ILibrary/CASynthesis -ILibrary/FFT -ILibrary/CAMath
-ILibrary/CAAnalyser "-I/Users/john/Documents/Dev/C2/build/C2 Project
XCode.build/Imported CodeWarrior Settings/C2 AU Debug.build/DerivedSources"
-isysroot /Developer/SDKs/MacOSX10.5.sdk -include
/Users/john/Documents/Dev/C2/C2/C2AU_debug.h -c
/Users/john/Documents/Dev/C2/Libraries/CAEffects/CAFilterBiquad.cpp -o
"/Users/john/Documents/Dev/C2/build/C2 Project XCode.build/Imported CodeWarrior
Settings/C2 AU Debug.build/Objects-normal/i386/CAFilterBiquad.o"

The command line for the linker is:

Ld "/Users/john/Documents/Dev/C2/build/C2 Project XCode.build/Imported
CodeWarrior Settings/C2 AU Debug.build/Objects-normal/i386/Alchemy" normal i386
    cd /Users/john/Documents/Dev/C2
    /Developer/usr/bin/g++-4.0 -o "/Users/john/Documents/Dev/C2/build/C2
Project XCode.build/Imported CodeWarrior Settings/C2 AU
Debug.build/Objects-normal/i386/Alchemy"
"-L/Users/john/Documents/Dev/C2/build/Imported CodeWarrior Settings"
"-F/Users/john/Documents/Dev/C2/build/Imported CodeWarrior Settings"
-F/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks
-F/Users/john/Documents/Dev/C2 -filelist "/Users/john/Documents/Dev/C2/build/C2
Project XCode.build/Imported CodeWarrior Settings/C2 AU
Debug.build/Objects-normal/i386/Alchemy.LinkFileList" -framework CoreFoundation
-framework CoreServices -framework AudioUnit -framework Carbon -framework
CoreAudio -framework AudioToolbox -framework CoreMIDI -framework QuickTime
-framework vecLib -framework IOKit -arch i386 -exported_symbols_list
C2/C2AU.exp -bundle -mmacosx-version-min=10.4 -Wl,-read_only_relocs,suppress
-isysroot /Developer/SDKs/MacOSX10.5.sdk


-- 
           Summary: pow() function outputs NaN in debug build
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: john at humanoidsounds dot co dot uk


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37559

Reply via email to