Possbile patch for compilation errors re possibly uninitialized variables at -Og
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
Re: Possbile patch for compilation errors re possibly uninitialized variables at -Og
Thank you for making me stop and think about this. I was basically full of crap; like the test case in 78394, the tree compiles just fine at -O0. I don't know where I got the idea that it didn't. Initializing dozens of variables just to make the tree compile at -Og might be nice in some abstract way, but it's a moving target, and I would be very surprised if it were worth the trouble. Louis On Fri, 29 Dec 2017 19:40:38 -0800 Eric Gallager wrote > On 12/29/17, Louis Krupp wrote: > > 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 > > > > Patches go to the gcc-patches mailing list instead. Also please be > aware of bug 78394: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78394 >