This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
tree-vrp.c: avoid using uninitialized value
- From: "Ralf Wildenhues" <Ralf dot Wildenhues at gmx dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 16 May 2007 19:42:59 +0200 (CEST)
- Subject: tree-vrp.c: avoid using uninitialized value
- References:
:ADDPATCH vrp:
I saw valgrind complain about this being used without being initialized:
==2479== Conditional jump or move depends on uninitialised value(s)
==2479== at 0x904876: vrp_evaluate_conditional_warnv (tree-vrp.c:4801)
==2479== by 0x907009: vrp_evaluate_conditional (tree-vrp.c:4933)
==2479== by 0x8C0FC4: substitute_and_fold (tree-ssa-propagate.c:1131)
==2479== by 0x8F5A1C: vrp_finalize (tree-vrp.c:5918)
==2479== by 0x90AFFA: execute_vrp (tree-vrp.c:6001)
==2479== by 0x746680: execute_one_pass (passes.c:1058)
==2479== by 0x74683B: execute_pass_list (passes.c:1110)
==2479== by 0x74684D: execute_pass_list (passes.c:1111)
==2479== by 0x81AB20: tree_rest_of_compilation (tree-optimize.c:406)
==2479== by 0x513BB5: expand_body (semantics.c:3131)
==2479== by 0x976C52: cgraph_expand_function (cgraphunit.c:1086)
==2479== by 0x978928: cgraph_optimize (cgraphunit.c:1155)
Do you want/need a reduced test case to expose this?
I think it's because in some cases compare_ranges may not set
strict_overflow_p, because compare_values_warnv may not do so.
Cheers,
Ralf
gcc/ChangeLog:
2007-05-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* tree-vrp.c (compare_names): Initialize sop.
Index: gcc/tree-vrp.c
=================================================================== ---
gcc/tree-vrp.c (revision 124767)
+++ gcc/tree-vrp.c (working copy)
@@ -4778,7 +4778,7 @@
t = retval = NULL_TREE;
EXECUTE_IF_SET_IN_BITMAP (e2, 0, i2, bi2)
{
- bool sop;
+ bool sop = false;
value_range_t vr2 = get_vr_for_comparison (i2);