The following code snippet triggers an ICE on mainline (i686-pc-linux-gnu)# when compiled with "-ffast-math": ======================================= double foo(double x) { return x; } double y = 2*foo(1); ======================================= bug0.cc:2: internal compiler error: Segmentation fault Please submit a full bug report, [etc.] The bug was introduced between 2008-08-23 and 2008-08-29.
Confirmed: Program received signal SIGSEGV, Segmentation fault. 0x082ac655 in optimize_function_for_speed_p (fun=0x0) at ../../gcc-svn/trunk/gcc/predict.c:205 /home/uros/gcc-svn/trunk/gcc/predict.c:205:6178:beg:0x82ac655 (gdb) bt #0 0x082ac655 in optimize_function_for_speed_p (fun=0x0) at ../../gcc-svn/trunk/gcc/predict.c:205 #1 0x081f3c53 in fold_binary (code=MULT_EXPR, type=0xb7c4e478, op0=0xb7f56294, op1=0xb7cd39bc) at ../../gcc-svn/trunk/gcc/fold-const.c:10414
Subject: Bug 37414 Author: jakub Date: Mon Sep 8 21:30:23 2008 New Revision: 140122 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=140122 Log: PR middle-end/37414 * predict.c (optimize_function_for_size_p): Don't segfault if FUN is NULL. * fold-const.c (LOGICAL_OP_NON_SHORT_CIRCUIT, fold_truthop, tree_swap_operands_p): Don't test cfun != NULL before calling optimize_function_for_s*_p. * g++.dg/opt/init2.C: New test. Added: trunk/gcc/testsuite/g++.dg/opt/init2.C Modified: trunk/gcc/ChangeLog trunk/gcc/fold-const.c trunk/gcc/predict.c trunk/gcc/testsuite/ChangeLog
Fixed.