I tried to build the trunk using: BOOT_CFLAGS='-g -Og' CFLAGS_FOR_TARGET='-g -Og' CFLAGS_FOR_BUILD='-g -Og'
I got a number of compilation warnings -- promoted to errors -- about possibly uninitialized variables. I have what I believe is a decent patch that initializes those variables and which I've tested at revision 256030. The errors go away for -Og, as well as for -O0. When I run make with no arguments and then run "make check", I get the same test failures as I do in an unmodified and identically built reference tree at the same revision. I've attached the patch along with a list of tentative ChangeLog entries and their respective directories. I can adjust the format of those entries as needed. Being able to build with -Og or -O0 would make my life easier. Louis Krupp
dir: gcc * expr.c: Fix -O0 compilation errors re unitialized variables (optimize_bitfield_assignment_op) (categorize_ctor_elements_1) (store_constructor) (expand_expr_real_1) * fold-const.c: Fix -O0 compilation errors re unitialized variables (get_array_ctor_element_at_index) * gimple-fold.c: Fix -O0 compilation errors re unitialized variables (fold_nonarray_ctor_reference) * gimplify.c: Fix -O0 compilation errors re unitialized variables (gimplify_init_ctor_eval) * ipa-prop.c: Fix -O0 compilation errors re unitialized variables (find_constructor_constant_at_offset) * ira-color.c: Fix -O0 compilation errors re unitialized variables (update_conflict_hard_regno_costs) * ira-lives.c: Fix -O0 compilation errors re unitialized variables (ira_rebuild_start_finish_chains) * lra-constraints.c: Fix -O0 compilation errors re unitialized variables (remove_inheritance_pseudos) * lto-cgraph.c: Fix -O0 compilation errors re unitialized variables (lto_output_node) * mode-switching.c: Fix -O0 compilation errors re unitialized variables (create_pre_exit) * optabs.c: Fix -O0 compilation errors re unitialized variables (expand_vec_perm) * reload.c: Fix -O0 compilation errors re unitialized variables (find_equiv_reg) * sel-sched.c: Fix -O0 compilation errors re unitialized variables (create_block_for_bookkeeping) * tree-cfg.c: Fix -O0 compilation errors re unitialized variables (verify_gimple_assign_single) (gimple_redirect_edge_and_branch) * tree-dfa.c: Fix -O0 compilation errors re unitialized variables (get_ref_base_and_extent) (get_addr_base_and_unit_offset_1) * tree-pretty-print.c: Fix -O0 compilation errors re unitialized variables (dump_generic_node) * tree-ssa-dom.c: Fix -O0 compilation errors re unitialized variables (test_for_singularity) * tree-ssa-forwprop.c: Fix -O0 compilation errors re unitialized variables (simplify_permutation) * tree-ssa-sccvn.c: Fix -O0 compilation errors re unitialized variables (vn_reference_lookup_3) * tree-vect-stmts.c: Fix -O0 compilation errors re unitialized variables (vectorizable_simd_clone_call) * valtrack.c: Fix -O0 compilation errors re unitialized variables (dead_debug_insert_temp) * var-tracking.c: Fix -O0 compilation errors re unitialized variables (emit_note_insn_var_location) dir: gcc/config/i386 * i386.c: Fix -O0 compilation errors re unitialized variables (ix86_option_override_internal) (ix86_expand_builtin) dir: gcc/cp * constexpr.c: Fix -O0 compilation errors re unitialized variables (cxx_eval_bit_field_ref) * init.c: Fix -O0 compilation errors re unitialized variables (build_vec_init) * parser.c: Fix -O0 compilation errors re unitialized variables (cp_parser_initializer_list) * pt.c: Fix -O0 compilation errors re unitialized variables (tsubst_omp_for_iterator) * typeck2.c: Fix -O0 compilation errors re unitialized variables (split_nonconstant_init_1) dir: gcc/fortran * trans-decl.c: Fix -O0 compilation errors re unitialized variables (finish_oacc_declare) * trans-intrinsic.c: Fix -O0 compilation errors re unitialized variables (nest_loop_dimension) dir: gcc/lto * lto.c: Fix -O0 compilation errors re unitialized variables (compare_tree_sccs_1) dir: libbacktrace * elf.c: Fix -O0 compilation errors re unitialized variables (elf_is_symlink)
Index: gcc/config/i386/i386.c =================================================================== --- gcc/config/i386/i386.c (revision 256030) +++ gcc/config/i386/i386.c (working copy) @@ -4720,7 +4720,7 @@ ix86_option_override_internal (bool main_args_p, { char *p = ASTRDUP (opts->x_ix86_recip_name); char *q; - unsigned int mask, i; + unsigned int mask = 0, i; bool invert; while ((q = strtok (p, ",")) != NULL) @@ -35342,7 +35342,7 @@ ix86_expand_builtin (tree exp, rtx target, rtx sub machine_mode mode, int ignore) { size_t i; - enum insn_code icode, icode2; + enum insn_code icode = CODE_FOR_nothing, icode2; tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0); tree arg0, arg1, arg2, arg3, arg4; rtx op0, op1, op2, op3, op4, pat, pat2, insn; Index: gcc/cp/constexpr.c =================================================================== --- gcc/cp/constexpr.c (revision 256030) +++ gcc/cp/constexpr.c (working copy) @@ -2544,7 +2544,7 @@ cxx_eval_bit_field_ref (const constexpr_ctx *ctx, tree whole = cxx_eval_constant_expression (ctx, orig_whole, lval, non_constant_p, overflow_p); - tree start, field, value; + tree start, field = NULL_TREE, value = NULL_TREE; unsigned HOST_WIDE_INT i; if (whole == orig_whole) Index: gcc/cp/init.c =================================================================== --- gcc/cp/init.c (revision 256030) +++ gcc/cp/init.c (working copy) @@ -4179,7 +4179,7 @@ build_vec_init (tree base, tree maxindex, tree ini /* Do non-default initialization of non-trivial arrays resulting from brace-enclosed initializers. */ unsigned HOST_WIDE_INT idx; - tree field, elt; + tree field = NULL_TREE, elt; /* If the constructor already has the array type, it's been through digest_init, so we shouldn't try to do anything more. */ bool digested = same_type_p (atype, TREE_TYPE (init)); Index: gcc/cp/parser.c =================================================================== --- gcc/cp/parser.c (revision 256030) +++ gcc/cp/parser.c (working copy) @@ -22133,7 +22133,7 @@ cp_parser_initializer_list (cp_parser* parser, boo if (first_designator) { unsigned int i; - tree designator, val; + tree designator, val = NULL_TREE; FOR_EACH_CONSTRUCTOR_ELT (v, i, designator, val) if (designator && TREE_CODE (designator) == IDENTIFIER_NODE) { Index: gcc/cp/pt.c =================================================================== --- gcc/cp/pt.c (revision 256030) +++ gcc/cp/pt.c (working copy) @@ -15740,7 +15740,7 @@ tsubst_omp_for_iterator (tree t, int i, tree declv } else if (init) { - tree *pc; + tree *pc = NULL; int j; for (j = (omp_parallel_combined_clauses == NULL ? 1 : 0); j < 2; j++) { Index: gcc/cp/typeck2.c =================================================================== --- gcc/cp/typeck2.c (revision 256030) +++ gcc/cp/typeck2.c (working copy) @@ -597,7 +597,7 @@ static bool split_nonconstant_init_1 (tree dest, tree init) { unsigned HOST_WIDE_INT idx; - tree field_index, value; + tree field_index, value = NULL_TREE; tree type = TREE_TYPE (dest); tree inner_type = NULL; bool array_type_p = false; Index: gcc/expr.c =================================================================== --- gcc/expr.c (revision 256030) +++ gcc/expr.c (working copy) @@ -4643,7 +4643,11 @@ optimize_bitfield_assignment_op (poly_uint64 pbits gimple *srcstmt; enum tree_code code; - unsigned HOST_WIDE_INT bitsize, bitpos, bitregion_start, bitregion_end; + unsigned HOST_WIDE_INT + bitsize = 0, + bitpos = 0, + bitregion_start = 0, + bitregion_end = 0; if (mode1 != VOIDmode || !pbitsize.is_constant (&bitsize) || !pbitpos.is_constant (&bitpos) @@ -5912,7 +5916,7 @@ categorize_ctor_elements_1 (const_tree ctor, HOST_ { unsigned HOST_WIDE_INT idx; HOST_WIDE_INT nz_elts, init_elts, num_fields; - tree value, purpose, elt_type; + tree value = NULL_TREE, purpose, elt_type; /* Whether CTOR is a valid constant initializer, in accordance with what initializer_constant_valid_p does. If inferred from the constructor @@ -6203,7 +6207,7 @@ store_constructor (tree exp, rtx target, int clear case QUAL_UNION_TYPE: { unsigned HOST_WIDE_INT idx; - tree field, value; + tree field, value = NULL_TREE; /* The storage order is specified for every aggregate type. */ reverse = TYPE_REVERSE_STORAGE_ORDER (type); @@ -6345,7 +6349,7 @@ store_constructor (tree exp, rtx target, int clear } case ARRAY_TYPE: { - tree value, index; + tree value = NULL_TREE, index = NULL_TREE; unsigned HOST_WIDE_INT i; int need_to_clear; tree domain; @@ -10448,7 +10452,7 @@ expand_expr_real_1 (tree exp, rtx target, machine_ if (TREE_CODE (treeop0) == CONSTRUCTOR) { unsigned HOST_WIDE_INT idx; - tree field, value; + tree field = NULL_TREE, value = NULL_TREE; scalar_int_mode field_mode; FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (treeop0), Index: gcc/fold-const.c =================================================================== --- gcc/fold-const.c (revision 256030) +++ gcc/fold-const.c (working copy) @@ -11878,7 +11878,7 @@ get_array_ctor_element_at_index (tree ctor, offset offset_int max_index; unsigned HOST_WIDE_INT cnt; - tree cfield, cval; + tree cfield = NULL_TREE, cval; FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (ctor), cnt, cfield, cval) { Index: gcc/fortran/trans-decl.c =================================================================== --- gcc/fortran/trans-decl.c (revision 256030) +++ gcc/fortran/trans-decl.c (working copy) @@ -6225,7 +6225,7 @@ finish_oacc_declare (gfc_namespace *ns, gfc_symbol gfc_oacc_declare *oc; locus where = gfc_current_locus; gfc_omp_clauses *omp_clauses = NULL; - gfc_omp_namelist *n, *p; + gfc_omp_namelist *n, *p = NULL; gfc_traverse_ns (ns, find_module_oacc_declare_clauses); Index: gcc/fortran/trans-intrinsic.c =================================================================== --- gcc/fortran/trans-intrinsic.c (revision 256030) +++ gcc/fortran/trans-intrinsic.c (working copy) @@ -9325,7 +9325,7 @@ static gfc_ss * nest_loop_dimension (gfc_ss *ss, int dim) { int ss_dim, i; - gfc_ss *new_ss, *prev_ss = gfc_ss_terminator; + gfc_ss *new_ss = NULL, *prev_ss = gfc_ss_terminator; gfc_loopinfo *new_loop; gcc_assert (ss != gfc_ss_terminator); Index: gcc/gimple-fold.c =================================================================== --- gcc/gimple-fold.c (revision 256030) +++ gcc/gimple-fold.c (working copy) @@ -6475,7 +6475,7 @@ fold_nonarray_ctor_reference (tree type, tree ctor tree from_decl) { unsigned HOST_WIDE_INT cnt; - tree cfield, cval; + tree cfield, cval = NULL_TREE; FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (ctor), cnt, cfield, cval) Index: gcc/gimplify.c =================================================================== --- gcc/gimplify.c (revision 256030) +++ gcc/gimplify.c (working copy) @@ -4531,7 +4531,7 @@ gimplify_init_ctor_eval (tree object, vec<construc { tree array_elt_type = NULL; unsigned HOST_WIDE_INT ix; - tree purpose, value; + tree purpose = NULL_TREE, value; if (TREE_CODE (TREE_TYPE (object)) == ARRAY_TYPE) array_elt_type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (object))); Index: gcc/ipa-prop.c =================================================================== --- gcc/ipa-prop.c (revision 256030) +++ gcc/ipa-prop.c (working copy) @@ -2992,7 +2992,7 @@ find_constructor_constant_at_offset (tree construc return NULL; unsigned ix; - tree index, val; + tree index = NULL_TREE, val = NULL_TREE; FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (constructor), ix, index, val) { HOST_WIDE_INT elt_offset; Index: gcc/ira-color.c =================================================================== --- gcc/ira-color.c (revision 256030) +++ gcc/ira-color.c (working copy) @@ -1466,12 +1466,12 @@ static void update_conflict_hard_regno_costs (int *costs, enum reg_class aclass, bool decr_p) { - int i, cost, class_size, freq, mult, div, divisor; + int i, cost, class_size, freq, mult, div, divisor = 0; int index, hard_regno; int *conflict_costs; bool cont_p; enum reg_class another_aclass; - ira_allocno_t allocno, another_allocno, from; + ira_allocno_t allocno = NULL, another_allocno, from; ira_copy_t cp, next_cp; while (get_next_update_cost (&allocno, &from, &divisor)) Index: gcc/ira-lives.c =================================================================== --- gcc/ira-lives.c (revision 256030) +++ gcc/ira-lives.c (working copy) @@ -1404,7 +1404,7 @@ ira_rebuild_start_finish_chains (void) static void remove_some_program_points_and_update_live_ranges (void) { - unsigned i; + unsigned i = 0; int n; int *map; ira_object_t obj; Index: gcc/lra-constraints.c =================================================================== --- gcc/lra-constraints.c (revision 256030) +++ gcc/lra-constraints.c (working copy) @@ -6585,7 +6585,7 @@ remove_inheritance_pseudos (bitmap remove_pseudos) basic_block bb; int regno, sregno, prev_sregno, dregno; rtx restore_rtx; - rtx set, prev_set; + rtx set = NULL, prev_set; rtx_insn *prev_insn; bool change_p, done_p; Index: gcc/lto/lto.c =================================================================== --- gcc/lto/lto.c (revision 256030) +++ gcc/lto/lto.c (working copy) @@ -1470,7 +1470,7 @@ compare_tree_sccs_1 (tree t1, tree t2, tree **map) if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR)) { unsigned i; - tree index, value; + tree index = NULL_TREE, value = NULL_TREE; /* Lengths have already been compared above. */ FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (t1), i, index, value) { Index: gcc/lto-cgraph.c =================================================================== --- gcc/lto-cgraph.c (revision 256030) +++ gcc/lto-cgraph.c (working copy) @@ -388,7 +388,7 @@ lto_output_node (struct lto_simple_output_block *o unsigned int tag; struct bitpack_d bp; bool boundary_p; - intptr_t ref; + intptr_t ref = 0; bool in_other_partition = false; struct cgraph_node *clone_of, *ultimate_clone_of; ipa_opt_pass_d *pass; Index: gcc/mode-switching.c =================================================================== --- gcc/mode-switching.c (revision 256030) +++ gcc/mode-switching.c (working copy) @@ -243,7 +243,7 @@ create_pre_exit (int n_entities, int *entity_map, { basic_block src_bb = eg->src; rtx_insn *last_insn; - rtx ret_reg; + rtx ret_reg = NULL; gcc_assert (!pre_exit); /* If this function returns a value at the end, we have to Index: gcc/optabs.c =================================================================== --- gcc/optabs.c (revision 256030) +++ gcc/optabs.c (working copy) @@ -5458,7 +5458,7 @@ rtx expand_vec_perm (machine_mode mode, rtx v0, rtx v1, rtx sel, rtx target) { enum insn_code icode; - machine_mode qimode; + machine_mode qimode = VOIDmode; unsigned int i, w, e, u; rtx tmp, sel_qi = NULL; rtvec vec; Index: gcc/reload.c =================================================================== --- gcc/reload.c (revision 256030) +++ gcc/reload.c (working copy) @@ -6641,7 +6641,7 @@ find_equiv_reg (rtx goal, rtx_insn *insn, enum reg rtx_insn *where; rtx pat; int regno = -1; - int valueno; + int valueno = 0; int goal_mem = 0; int goal_const = 0; int goal_mem_addr_varies = 0; Index: gcc/sel-sched.c =================================================================== --- gcc/sel-sched.c (revision 256030) +++ gcc/sel-sched.c (working copy) @@ -4585,7 +4585,7 @@ create_block_for_bookkeeping (edge e1, edge e2) if (MAY_HAVE_DEBUG_INSNS) { - basic_block succ; + basic_block succ = NULL; insn_t insn = sel_bb_head (new_bb); insn_t last; Index: gcc/tree-cfg.c =================================================================== --- gcc/tree-cfg.c (revision 256030) +++ gcc/tree-cfg.c (working copy) @@ -4668,7 +4668,7 @@ verify_gimple_assign_single (gassign *stmt) if (TREE_CODE (rhs1_type) == VECTOR_TYPE) { unsigned int i; - tree elt_i, elt_v, elt_t = NULL_TREE; + tree elt_i = NULL_TREE, elt_v, elt_t = NULL_TREE; if (CONSTRUCTOR_NELTS (rhs1) == 0) return res; @@ -6052,7 +6052,7 @@ gimple_redirect_edge_and_branch (edge e, basic_blo if (cases) { edge e2 = find_edge (e->src, dest); - tree last, first; + tree last = NULL_TREE, first; first = cases; while (cases) Index: gcc/tree-dfa.c =================================================================== --- gcc/tree-dfa.c (revision 256030) +++ gcc/tree-dfa.c (working copy) @@ -486,7 +486,7 @@ get_ref_base_and_extent (tree exp, poly_int64_pod case ARRAY_RANGE_REF: { tree index = TREE_OPERAND (exp, 1); - tree low_bound, unit_size; + tree low_bound, unit_size = NULL_TREE; /* If the resulting bit-offset is constant, track it. */ if (poly_int_tree_p (index) @@ -751,7 +751,7 @@ get_addr_base_and_unit_offset_1 (tree exp, poly_in case ARRAY_RANGE_REF: { tree index = TREE_OPERAND (exp, 1); - tree low_bound, unit_size; + tree low_bound, unit_size = NULL_TREE; if (valueize && TREE_CODE (index) == SSA_NAME) Index: gcc/tree-pretty-print.c =================================================================== --- gcc/tree-pretty-print.c (revision 256030) +++ gcc/tree-pretty-print.c (working copy) @@ -1992,7 +1992,7 @@ dump_generic_node (pretty_printer *pp, tree node, case CONSTRUCTOR: { unsigned HOST_WIDE_INT ix; - tree field, val; + tree field = NULL_TREE, val; bool is_struct_init = false; bool is_array_init = false; widest_int curidx; Index: gcc/tree-ssa-dom.c =================================================================== --- gcc/tree-ssa-dom.c (revision 256030) +++ gcc/tree-ssa-dom.c (working copy) @@ -1804,7 +1804,7 @@ test_for_singularity (gimple *stmt, gcond *dummy_c if (is_gimple_assign (stmt) || gimple_code (stmt) == GIMPLE_COND) { enum tree_code code = ERROR_MARK; - tree lhs, rhs; + tree lhs = NULL_TREE, rhs = NULL_TREE; /* Extract the condition of interest from both forms we support. */ if (is_gimple_assign (stmt)) Index: gcc/tree-ssa-forwprop.c =================================================================== --- gcc/tree-ssa-forwprop.c (revision 256030) +++ gcc/tree-ssa-forwprop.c (working copy) @@ -1889,7 +1889,7 @@ static int simplify_permutation (gimple_stmt_iterator *gsi) { gimple *stmt = gsi_stmt (*gsi); - gimple *def_stmt; + gimple *def_stmt = NULL; tree op0, op1, op2, op3, arg0, arg1; enum tree_code code; bool single_use_op0 = false; Index: gcc/tree-ssa-sccvn.c =================================================================== --- gcc/tree-ssa-sccvn.c (revision 256030) +++ gcc/tree-ssa-sccvn.c (working copy) @@ -1822,7 +1822,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, voi vn_reference_t vr = (vn_reference_t)vr_; gimple *def_stmt = SSA_NAME_DEF_STMT (vuse); tree base = ao_ref_base (ref); - HOST_WIDE_INT offseti, maxsizei; + HOST_WIDE_INT offseti = 0, maxsizei = 0; static vec<vn_reference_op_s> lhs_ops; ao_ref lhs_ref; bool lhs_ref_ok = false; Index: gcc/tree-vect-stmts.c =================================================================== --- gcc/tree-vect-stmts.c (revision 256030) +++ gcc/tree-vect-stmts.c (working copy) @@ -3214,7 +3214,7 @@ vectorizable_simd_clone_call (gimple *stmt, gimple bb_vec_info bb_vinfo = STMT_VINFO_BB_VINFO (stmt_info); vec_info *vinfo = stmt_info->vinfo; struct loop *loop = loop_vinfo ? LOOP_VINFO_LOOP (loop_vinfo) : NULL; - tree fndecl, new_temp; + tree fndecl, new_temp = NULL_TREE; gimple *def_stmt; gimple *new_stmt = NULL; int ncopies, j; Index: gcc/valtrack.c =================================================================== --- gcc/valtrack.c (revision 256030) +++ gcc/valtrack.c (working copy) @@ -648,7 +648,7 @@ dead_debug_insert_temp (struct dead_debug_local *d if (where == DEBUG_TEMP_BEFORE_WITH_VALUE) { rtx set = single_set (insn); - rtx dest, src; + rtx dest = NULL, src = NULL; if (set) { Index: gcc/var-tracking.c =================================================================== --- gcc/var-tracking.c (revision 256030) +++ gcc/var-tracking.c (working copy) @@ -8686,7 +8686,7 @@ emit_note_insn_var_location (variable **varp, emit var->var_part[i].cur_loc = var->var_part[i].loc_chain->loc; for (i = 0; i < var->n_var_parts; i++) { - machine_mode mode, wider_mode; + machine_mode mode, wider_mode = VOIDmode; rtx loc2; HOST_WIDE_INT offset; Index: libbacktrace/elf.c =================================================================== --- libbacktrace/elf.c (revision 256030) +++ libbacktrace/elf.c (working copy) @@ -735,6 +735,7 @@ elf_is_symlink (const char *filename) { struct stat st; + st.st_mode = 0; if (lstat (filename, &st) < 0) return 0; return S_ISLNK (st.st_mode);