* tree-vrp.c: avoid using uninitialized value
@ 2007-05-16 17:43 Ralf Wildenhues
2007-05-16 18:02 ` Ralf Wildenhues
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ralf Wildenhues @ 2007-05-16 17:43 UTC (permalink / raw)
To: gcc-patches
: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);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: tree-vrp.c: avoid using uninitialized value
2007-05-16 17:43 tree-vrp.c: avoid using uninitialized value Ralf Wildenhues
@ 2007-05-16 18:02 ` Ralf Wildenhues
2007-05-18 17:13 ` Ralf Wildenhues
2007-05-31 0:31 ` Ian Lance Taylor
2 siblings, 0 replies; 4+ messages in thread
From: Ralf Wildenhues @ 2007-05-16 18:02 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 261 bytes --]
Of course I manage to post a broken patch. Apologies. Next try.
FWIW, I don't have any commit privileges, nor can I currently do
regtesting.
gcc/ChangeLog:
2007-05-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* tree-vrp.c (compare_names): Initialize sop.
[-- Attachment #2: p.diff --]
[-- Type: text/plain, Size: 358 bytes --]
Index: gcc/tree-vrp.c
===================================================================
--- gcc/tree-vrp.c (revision 124775)
+++ 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);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: tree-vrp.c: avoid using uninitialized value
2007-05-16 17:43 tree-vrp.c: avoid using uninitialized value Ralf Wildenhues
2007-05-16 18:02 ` Ralf Wildenhues
@ 2007-05-18 17:13 ` Ralf Wildenhues
2007-05-31 0:31 ` Ian Lance Taylor
2 siblings, 0 replies; 4+ messages in thread
From: Ralf Wildenhues @ 2007-05-18 17:13 UTC (permalink / raw)
To: gcc-patches
* Ralf Wildenhues wrote on Wed, May 16, 2007 at 07:42:59PM CEST:
>
> 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?
Never mind. This has been fixed by the patch that fixed
PR tree-optimization/31953.
FWIW, below is a reduced test case that exposed the issue before the
fix.
Cheers,
Ralf
typedef double array[1];
void func(array a1, array a2, array a3,
const int dimlow, const int dimhigh)
{
int idim;
for (idim = dimlow; idim < dimhigh; idim++)
a1[idim] = 0.0;
for (idim = dimlow; idim < dimhigh; idim++)
a2[idim] = 0.0;
for (idim = dimlow; idim < dimhigh; idim++)
a3[idim] = 0.0;
}
int main(int argc, char* argv[])
{
array a1, a2, a3;
func(a1, a2, a3, 0, 1);
return 0;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: tree-vrp.c: avoid using uninitialized value
2007-05-16 17:43 tree-vrp.c: avoid using uninitialized value Ralf Wildenhues
2007-05-16 18:02 ` Ralf Wildenhues
2007-05-18 17:13 ` Ralf Wildenhues
@ 2007-05-31 0:31 ` Ian Lance Taylor
2 siblings, 0 replies; 4+ messages in thread
From: Ian Lance Taylor @ 2007-05-31 0:31 UTC (permalink / raw)
To: Ralf Wildenhues; +Cc: gcc-patches
"Ralf Wildenhues" <Ralf.Wildenhues@gmx.de> writes:
> 2007-05-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
>
> * tree-vrp.c (compare_names): Initialize sop.
Thanks for the patch.
I bootstrapped and tested this on i686-pc-linux-gnu, and committed it
to both mainline and 4.2 branch.
:REVIEWMAIL:
Ian
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-05-30 22:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-16 17:43 tree-vrp.c: avoid using uninitialized value Ralf Wildenhues
2007-05-16 18:02 ` Ralf Wildenhues
2007-05-18 17:13 ` Ralf Wildenhues
2007-05-31 0:31 ` Ian Lance Taylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).