------- Comment #10 from rguenth at gcc dot gnu dot org 2008-04-02 20:50 ------- Ah, the following
/* Index jumptables from zero for suitable values of minval to avoid a subtraction. */ if (! optimize_size && compare_tree_int (minval, 0) > 0 && compare_tree_int (minval, 3) < 0) { minval = build_int_cst (index_type, 0); range = maxval; } relies on the created hole be filled by the default_label - but that is NULL here. So, the following looks like the right fix here: Index: stmt.c =================================================================== --- stmt.c (revision 133848) +++ stmt.c (working copy) @@ -2566,11 +2566,15 @@ expand_case (tree exp) = gen_rtx_LABEL_REF (Pmode, label_rtx (n->code_label)); } - /* Fill in the gaps with the default. */ - if (default_label) - for (i = 0; i < ncases; i++) - if (labelvec[i] == 0) - labelvec[i] = gen_rtx_LABEL_REF (Pmode, default_label); + /* Fill in the gaps with the default. We may have gaps at + the beginning if we tried to avoid the minval subtraction, + so substitute some label even if the default label was + deemed unreachable. */ + if (!default_label) + default_label = label_rtx (case_list->code_label); + for (i = 0; i < ncases; i++) + if (labelvec[i] == 0) + labelvec[i] = gen_rtx_LABEL_REF (Pmode, default_label); /* Output the table. */ emit_label (table_label); -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35800