ICE (segmentation fault) compiling a function containing two math functions (log and rint), using -ffast-math and -O1 (or 2, 3 or s). Error does not occur when -ffast-math not used. Error does not occur when optimisation flag not used (or if -O0 used).
To reproduce, compile the following: #include <math.h> int f (float x) { int a, b; a = log(2.f); b = rint(x); return(a+b); } Using: $ gcc -ffast-math -O1 -c test.c Gives the following output: test.c: In function 'f': test.c:7: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. However, neither of $ gcc -O1 -c test.c nor $ gcc -ffast-math -c test.c cause the same error. $ gcc -v Using built-in specs. Target: i686-pc-linux-gnu Configured with: ../gcc-4.1-20050730/configure --prefix=/usr/local/gcc41 Thread model: posix gcc version 4.1.0 20050730 (experimental) -- Summary: ICE using math functions log & rint, -ffast-math, -O1 (,2,3,s) Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: plgs at ozemail dot com dot au CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23268