This is the mail archive of the gcc-bugs@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]

GCC48/49 crash on fast floating point math in combination with -O3


Hi,

Looks like one of the -O3 optimising steps are broken:

cat << EOF > powfcrash.cpp
#include <stdio.h>
#include <cmath>

class test
{
public:
        unsigned char y;
        void testfn(unsigned char);
};

void
test :: testfn(unsigned char x)
{
        y = x;
        float fr = expf(powf(y / 127.0f, 0.5f) * logf(25000.0f)) + 40.0f;
        printf("%f Result\n", fr);
}

int main()
{
        class test test;
        test.testfn(2.0);

        return (0);
}
EOF

g++48 -O3 -ffast-math -Wall -Wextra powfcrash.cpp

powfcrash.cpp: In member function 'void test::testfn(unsigned char)':
powfcrash.cpp:12:1: internal compiler error: Segmentation fault: 11
 test :: testfn(unsigned char x)
 ^
no stack trace because unwind library not available
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


 g++48 -v
Using built-in specs.
COLLECT_GCC=g++48
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc48/gcc/x86_64-portbld-freebsd9.1/4.8.3/lto-wrapper
Target: x86_64-portbld-freebsd9.1
Configured with: ./../gcc-4.8.3/configure --disable-bootstrap --disable-nls --enable-gnu-indirect-function --libdir=/usr/local/lib/gcc48 --libexecdir=/usr/local/libexec/gcc48 --program-suffix=48 --with-as=/usr/local/bin/as --with-gmp=/usr/local --with-gxx-include-dir=/usr/local/lib/gcc48/include/c++/ --with-ld=/usr/local/bin/ld --with-libiconv-prefix=/usr/local --with-pkgversion='FreeBSD Ports Collection' --with-system-zlib --with-ecj-jar=/usr/local/share/java/ecj-4.5.jar --enable-languages=c,c++,objc,fortran,java --prefix=/usr/local --mandir=/usr/local/man --infodir=/usr/local/info/gcc48 --build=x86_64-portbld-freebsd9.1
Thread model: posix
gcc version 4.8.3 (FreeBSD Ports Collection)

Thank you!

--HPS


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