The attached testcase causes a segmentation fault in tree tailcall elimination. It looks like it expects local1 (a static), to have a default_def, which it doesn't
Created attachment 6874 [details] Minimal testcase for this bug
Sorry, thought Zdenek wrote the tailcall part
Actually I believe the code in question is mine. This patch should fix the problem, I will send it to gcc-patches once it passes testing. Index: tree-tailcall.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/tree-tailcall.c,v retrieving revision 2.19 diff -c -3 -p -r2.19 tree-tailcall.c *** tree-tailcall.c 28 Jul 2004 05:13:09 -0000 2.19 --- tree-tailcall.c 4 Aug 2004 12:24:55 -0000 *************** eliminate_tail_call (struct tailcall *t) *** 730,736 **** if (!phi) { tree name = var_ann (param)->default_def; ! tree new_name = make_ssa_name (param, SSA_NAME_DEF_STMT (name)); var_ann (param)->default_def = new_name; phi = create_phi_node (name, first); --- 730,746 ---- if (!phi) { tree name = var_ann (param)->default_def; ! tree new_name; ! ! if (!name) ! { ! /* It may happen that the tag does not have a default_def in case ! when all uses of it are dominated by a MUST_DEF. This however ! means that it is not necessary to add a phi node for this ! tag. */ ! continue; ! } ! new_name = make_ssa_name (param, SSA_NAME_DEF_STMT (name)); var_ann (param)->default_def = new_name; phi = create_phi_node (name, first);
Subject: Bug 16864 CVSROOT: /cvs/gcc Module name: gcc Changes by: rakdver@gcc.gnu.org 2004-08-05 08:41:57 Modified files: gcc : ChangeLog tree-tailcall.c Log message: PR tree-optimization/16864 * tree-tailcall.c (eliminate_tail_call): Do not create phi nodes for ssa names without default_def. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.4808&r2=2.4809 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-tailcall.c.diff?cvsroot=gcc&r1=2.19&r2=2.20
Fixed.