Bootstrap with -O3 dies with error bellow. It is false alarm about use of uninitialized variable. With -O2 the warning doesn't trigger. make[2]: Entering directory `/home/4/wilx/tmp/gcc-head/objdir/gcc' stage1/xgcc -Bstage1/ -B/home/4/wilx/i386-unknown-freebsd4.10/bin/ -c -O3 -g -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-macros -Wold-style-definition -Werror -fno-common -DHAVE_CONFIG_H -I. -I. -I../../srcdir/gcc -I../../srcdir/gcc/. -I../../srcdir/gcc/../include -I../../srcdir/gcc/../libcpp/include -I../../srcdir/gcc/../libbanshee/libcompat -I../../srcdir/gcc/../libbanshee -I../../srcdir/gcc/../libbanshee/points-to ../../srcdir/gcc/loop-iv.c -o loop-iv.o ../../srcdir/gcc/loop-iv.c: In function `simplify_using_initial_values': ../../srcdir/gcc/loop-iv.c:1360: warning: 'lhs' may be used uninitialized in this function make[2]: *** [loop-iv.o] Error 1 make[2]: Leaving directory `/home/4/wilx/tmp/gcc-head/objdir/gcc' make[1]: *** [stage2_build] Error 2 make[1]: Leaving directory `/home/4/wilx/tmp/gcc-head/objdir/gcc' make: *** [bootstrap] Error 2 I've used this to unbreak the bootstrap: Index: gcc/loop-iv.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/loop-iv.c,v retrieving revision 2.13 diff -c -p -r2.13 loop-iv.c *** gcc/loop-iv.c 27 Jul 2004 07:27:12 -0000 2.13 --- gcc/loop-iv.c 3 Aug 2004 20:22:07 -0000 *************** static void *** 1357,1363 **** simplify_using_assignment (rtx insn, rtx *expr, regset altered) { rtx set = single_set (insn); ! rtx lhs, rhs; bool ret = false; if (set) --- 1357,1363 ---- simplify_using_assignment (rtx insn, rtx *expr, regset altered) { rtx set = single_set (insn); ! rtx lhs = 0, rhs; bool ret = false; if (set)
Confirmed and the reason why it does not trigger at -O2 is because altered_reg_used does not get inlined so the variable is consided to take the address of so we cannot warn about that. I will commit the obvious fix.
Subject: Bug 16865 CVSROOT: /cvs/gcc Module name: gcc Changes by: pinskia@gcc.gnu.org 2004-08-03 21:13:15 Modified files: gcc : ChangeLog loop-iv.c Log message: 2004-08-03 Andrew Pinski <apinski@apple.com> PR bootstrap/16865 * loop-iv.c (simplify_using_assignment): Initialize lhs. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.4784&r2=2.4785 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/loop-iv.c.diff?cvsroot=gcc&r1=2.13&r2=2.14
Fixed.
I posted the PR too early. There were some more: ../../srcdir/gcc/var-tracking.c:2500: warning: 'offset' may be used uninitialized in this function ../../srcdir/gcc/var-tracking.c:2499: warning: 'decl' may be used uninitialized in this function ../../srcdir/gcc/cp/parser.c:6742: warning: 'token2$type' may be used uninitialized in this function ../../srcdir/gcc/cp/parser.c:6742: warning: 'token2$keyword' may be used uninitialized in this function
The var-tracking ones look like a real bug in the compiler code (not in this var-tracking one though): if (!vt_get_decl_and_offset (incoming, &decl, &offset)) if (!vt_get_decl_and_offset (decl_rtl, &decl, &offset)) continue; Now the cp/parser one is really a true posiable use of the uninitialized variable.
Bootstrap of yesterday's CVS sources showed some more of these. Worked around with patch bellow: Index: gcc/tree-vectorizer.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/tree-vectorizer.c,v retrieving revision 2.2 diff -c -p -r2.2 tree-vectorizer.c *** gcc/tree-vectorizer.c 19 Aug 2004 07:16:55 -0000 2.2 --- gcc/tree-vectorizer.c 19 Aug 2004 08:44:21 -0000 *************** vect_create_index_for_array_ref (tree st *** 591,597 **** loop_vec_info loop_info = loop->aux; int vectorization_factor = LOOP_VINFO_VECT_FACTOR (loop_info); tree vf; ! tree array_first_index; tree indx_before_incr, indx_after_incr; int loopnum = loop->num; bool ok; --- 591,597 ---- loop_vec_info loop_info = loop->aux; int vectorization_factor = LOOP_VINFO_VECT_FACTOR (loop_info); tree vf; ! tree array_first_index = NULL_TREE; tree indx_before_incr, indx_after_incr; int loopnum = loop->num; bool ok; *************** vect_compute_data_ref_alignment (struct *** 2248,2254 **** tree init; tree scalar_type; tree misalign; ! tree array_first_index; tree array_base = DR_BASE_NAME (dr); tree base_decl = NULL_TREE; tree bit_offset = size_zero_node; --- 2248,2254 ---- tree init; tree scalar_type; tree misalign; ! tree array_first_index = NULL_TREE; tree array_base = DR_BASE_NAME (dr); tree base_decl = NULL_TREE; tree bit_offset = size_zero_node;
Here is some more with --enable-intermodule which means a huge amount more inlining: /Users/pinskia/src/local/gcc/gcc/cfgbuild.c: In function 'make_edges': /Users/pinskia/src/local/gcc/gcc/cfgbuild.c:289: warning: 'tmp' may be used uninitialized in this function /Users/pinskia/src/local/gcc/gcc/jump.c: In function 'delete_related_insns': /Users/pinskia/src/local/gcc/gcc/jump.c:1390: warning: 'lab_next' may be used uninitialized in this function /Users/pinskia/src/local/gcc/gcc/cfgrtl.c: In function 'cfg_layout_delete_block': /Users/pinskia/src/local/gcc/gcc/cfgrtl.c:369: warning: 'tmp' may be used uninitialized in this function /Users/pinskia/src/local/gcc/gcc/cfgrtl.c: In function 'rtl_delete_block': /Users/pinskia/src/local/gcc/gcc/cfgrtl.c:369: warning: 'tmp' may be used uninitialized in this function /Users/pinskia/src/local/gcc/gcc/tree-ssa-dom.c: In function 'simplify_cond_and_lookup_avail_expr': /Users/pinskia/src/local/gcc/gcc/tree-ssa-dom.c:1912: warning: 'cond_inverted' may be used uninitialized in this function /Users/pinskia/src/local/gcc/gcc/tree-ssa-dom.c:1911: warning: 'cond_low' may be used uninitialized in this function /Users/pinskia/src/local/gcc/gcc/tree-ssa-dom.c:1911: warning: 'cond_high' may be used uninitialized in this function /Users/pinskia/src/local/gcc/gcc/tree-ssa-dom.c:2015: warning: 'tmp_low' may be used uninitialized in this function /Users/pinskia/src/local/gcc/gcc/tree-ssa-dom.c:2015: warning: 'tmp_high' may be used uninitialized in this function /Users/pinskia/src/local/gcc/gcc/tree-ssa-loop-ivopts.c: In function 'get_computation_at': /Users/pinskia/src/local/gcc/gcc/tree-ssa-loop-ivopts.c:2158: warning: 'ratioi' may be used uninitialized in this function /Users/pinskia/src/local/gcc/gcc/var-tracking.c: In function 'vt_initialize': /Users/pinskia/src/local/gcc/gcc/var-tracking.c:2500: warning: 'decl' may be used uninitialized in this function /Users/pinskia/src/local/gcc/gcc/var-tracking.c:2501: warning: 'offset' may be used uninitialized in this function /Users/pinskia/src/local/gcc/gcc/cfgcleanup.c: In function 'try_crossjump_to_edge': /Users/pinskia/src/local/gcc/gcc/cfgcleanup.c:1358: warning: 'table1' may be used uninitialized in this function /Users/pinskia/src/local/gcc/gcc/cfgcleanup.c:1357: warning: 'label1' may be used uninitialized in this function /Users/pinskia/src/local/gcc/gcc/cfgcleanup.c:1358: warning: 'table2' may be used uninitialized in this function /Users/pinskia/src/local/gcc/gcc/cfgcleanup.c:1357: warning: 'label2' may be used uninitialized in this function /Users/pinskia/src/local/gcc/gcc/cfgcleanup.c:1572: warning: 'label1' may be used uninitialized in this function /Users/pinskia/src/local/gcc/gcc/cfgcleanup.c:1572: warning: 'label2' may be used uninitialized in this function /Users/pinskia/src/local/gcc/gcc/cfgrtl.c: In function 'redirect_branch_edge': /Users/pinskia/src/local/gcc/gcc/cfgrtl.c:871: warning: 'tmp' may be used uninitialized in this function /Users/pinskia/src/local/gcc/gcc/cfgrtl.c: In function 'force_nonfallthru_and_redirect': /Users/pinskia/src/local/gcc/gcc/cfgrtl.c:993: warning: 'note' may be used uninitialized in this function /Users/pinskia/src/local/gcc/gcc/cfgrtl.c: In function 'try_redirect_by_replacing_jump': /Users/pinskia/src/local/gcc/gcc/cfgrtl.c:772: warning: 'table' may be used uninitialized in this function /Users/pinskia/src/local/gcc/gcc/cfgrtl.c:772: warning: 'label' may be used uninitialized in this function /Users/pinskia/src/local/gcc/gcc/cfgcleanup.c: In function 'try_optimize_cfg': /Users/pinskia/src/local/gcc/gcc/cfgcleanup.c:729: warning: 'table' may be used uninitialized in this function /Users/pinskia/src/local/gcc/gcc/cfgcleanup.c:729: warning: 'label' may be used uninitialized in this function /Users/pinskia/src/local/gcc/gcc/cse.c: In function 'fold_rtx': /Users/pinskia/src/local/gcc/gcc/cse.c:3224: warning: 'next' may be used uninitialized in this function /Users/pinskia/src/local/gcc/gcc/tree-ssa-loop-ivopts.c: In function 'get_computation_cost_at': /Users/pinskia/src/local/gcc/gcc/tree-ssa-loop-ivopts.c:2802: warning: 'ratio' may be used uninitialized in this function /Users/pinskia/src/local/gcc/gcc/value-prof.c: In function 'rtl_value_profile_transformations': /Users/pinskia/src/local/gcc/gcc/value-prof.c:929: warning: 'write' may be used uninitialized in this function Most of these come from inlining tablejump_p.
What is the status on this one?
Well it still happens.
Won't fix for GCC-4.0.x
I guess this is now passé.