Command line: $ gcc -fkeep-inline-functions -O[123s] testcase.c Valgrind output: $ valgrind -q --trace-children=yes /mnt/svn/gcc-trunk/binary-162056-lto-fortran-checking-yes-rtl-df/bin/gcc -fkeep-inline-functions -O1 testcase.c ==20756== Invalid read of size 8 ==20756== at 0x8CD66D: gimple_default_def (tree-dfa.c:539) ==20756== by 0xADB938: setup_one_parameter (tree-inline.c:2527) ==20756== by 0xAE140D: optimize_inline_calls (tree-inline.c:2690) ==20756== by 0xAB9129: cgraph_early_inlining (ipa-inline.c:1783) ==20756== by 0x7B813D: execute_one_pass (passes.c:1565) ==20756== by 0x7B83D4: execute_pass_list (passes.c:1620) ==20756== by 0x7B763B: do_per_function_toporder (passes.c:1158) ==20756== by 0x7B87F5: execute_ipa_pass_list (passes.c:1920) ==20756== by 0xAB0350: cgraph_optimize (cgraphunit.c:1851) ==20756== by 0xAB05AA: cgraph_finalize_compilation_unit (cgraphunit.c:1171) ==20756== by 0x4DF2D2: c_write_global_declarations (c-decl.c:9698) ==20756== by 0x8A41E5: toplev_main (toplev.c:997) ==20756== Address 0x40 is not stack'd, malloc'd or (recently) free'd ==20756== testcase.c: In function 'bar': testcase.c:11:7: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. Tested revisions: r162056 - crash r159696 - crash r158969 - crash r158095 - OK 4.5 r160526 - OK
Created attachment 21222 [details] reduced testcase (from ffmpeg sources) Command line: $ gcc -fkeep-inline-functions -O1 pr44964.c
It is caused by revision 158477: http://gcc.gnu.org/ml/gcc-cvs/2010-04/msg00583.html
Program received signal SIGSEGV, Segmentation fault. 0x0000000000a293b1 in gimple_default_def (fn=0x7ffff7ee1480, var=0x7ffff7edb880) at /space/rguenther/src/svn/trunk/gcc/tree-dfa.c:538 538 return (tree) htab_find_with_hash (DEFAULT_DEFS (fn), &in, DECL_UID (var)); (gdb) p fn->gimple_df $2 = (struct gimple_df *) 0x0 obviously that function (baz) is not in SSA form. Still we want to inline it. Huh. node->analyzed is true for it. Huhuh.
Reconfirmed.
Looking at it.
It is caused by breaking edges to callees for always-inline functions when topologically sorting the cgraph. And cgraph_flatten misses a check for matching SSA form like other inliners have. I have a patch.
Author: rguenth Date: Wed Nov 10 16:05:03 2010 New Revision: 166543 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=166543 Log: 2010-11-10 Richard Guenther <rguenther@suse.de> PR tree-optimization/44964 * ipa-inline.c (cgraph_flatten): Check that SSA form matches. * gcc.dg/pr44964.c: New testcase. Added: trunk/gcc/testsuite/gcc.dg/pr44964.c Modified: trunk/gcc/ChangeLog trunk/gcc/ipa-inline.c trunk/gcc/testsuite/ChangeLog
Fixed.