public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* GCC48/49 crash on fast floating point math in combination with -O3
@ 2014-10-24 13:05 Hans Petter Selasky
  0 siblings, 0 replies; only message in thread
From: Hans Petter Selasky @ 2014-10-24 13:05 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-10-24 12:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-24 13:05 GCC48/49 crash on fast floating point math in combination with -O3 Hans Petter Selasky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).