tree-vrp.c: avoid using uninitialized value

Ralf Wildenhues Ralf.Wildenhues@gmx.de
Fri May 18 17:13:00 GMT 2007


* 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;
}



More information about the Gcc-patches mailing list