|
From: Jean-Marc V.
|
Hi,
I have the following code, for which valgrind reports an error, altho=
ugh
it is perfectly valid:
used=3D0;
if (i<N || dist<best_dist[N-1])
{
//Error reported=20
for (k=3DN-1; (k >=3D 1) && (k > used || dist < best_dist[k-1]); k=
--)
{
best_dist[k]=3Dbest_dist[k-1];
nbest[k] =3D nbest[k-1];
}
best_dist[k]=3Ddist;
nbest[k]=3Di;
used++;
}
what seems to be causing the problem is that best_dist is not
initialized. However initialization should not be necessary because t=
he
part before the ||
=09Jean-Marc
--=20
Jean-Marc Valin <Jean-Marc.Valin@USherbrooke.ca>
Universit=E9 de Sherbrooke
|