|
From: Paul F. <pa...@fr...> - 2007-06-11 14:58:40
|
Hi
We're getting a "Conditional jump or move depends on uninitialised value(s)"
error detected in the following code
if ((min != _UNDEF) && (max != _UNDEF)) { /* NO ERROR HERE ?? */
if (min > max) {
toto = min;
min=max;
max = toto;
}
}
wave->upd_minmax = 0;
if (min == _UNDEF) { /* ERROR HERE */
wave->upd_minmax = 1;
wave->min_wave = loc_main_header->undef;
}
else {
wave->min_wave = min;
}
if (max == _UNDEF) { /* ANOTHER ERROR HERE */
wave->upd_minmax = 1;
wave->max_wave = loc_main_header->undef;
}
else {
wave->max_wave = max;
}
min and max are double formal parameters, which come from a call 2 levels
higher, where the actual parameters are macro instances.
I really can't see why Valgrind detects an error. Unfortunately, I haven't been
able to reproduce this with a smaller testcase (the app under test is ~1M LOC).
Any ideas where I can look, or shall I just put this one on the suppressions
file?
A+
Paul
|
|
From: Christoph B. <bar...@or...> - 2007-06-13 08:07:38
|
You could try to add: VALGRIND_CHECK_VALUE_IS_DEFINED(min); VALGRIND_CHECK_VALUE_IS_DEFINED(max); In front of the code and some levels up, if the error is reproducable. To do this add #include <valgrind/memcheck.h> Christoph |
|
From: Paul F. <pa...@fr...> - 2007-06-13 15:45:55
|
Quoting Christoph Bartoschek <bar...@or...>:
> You could try to add:
>
> VALGRIND_CHECK_VALUE_IS_DEFINED(min);
> VALGRIND_CHECK_VALUE_IS_DEFINED(max);
>
> In front of the code and some levels up, if the error is reproducable.
>
> To do this add #include <valgrind/memcheck.h>
Hi
I did this, and nothing was added to the logfile. Then I did some more tests.
When I added
VALGRIND_PRINTF("min %p %g %g", &min, min, _UNDEF);
just before the supposed error site,
a) the error went away
b) I didn't get any "%g" output (perhaps this is normal?)
A+
Paul
|
|
From: Nicholas N. <nj...@cs...> - 2007-06-13 16:35:01
|
On Wed, 13 Jun 2007, Paul Floyd wrote:
> When I added
>
> VALGRIND_PRINTF("min %p %g %g", &min, min, _UNDEF);
>
> just before the supposed error site,
>
> a) the error went away
> b) I didn't get any "%g" output (perhaps this is normal?)
I don't know what the %g is supposed to do, but Valgrind's internal printf
doesn't handle floats or doubles, and VALGRIND_PRINTF will also not handle
arguments larger than word-size.
What is _UNDEF? Could it be undefined?
Nick
|
|
From: Paul F. <pa...@fr...> - 2007-06-13 16:43:15
|
Quoting Nicholas Nethercote <nj...@cs...>:
> On Wed, 13 Jun 2007, Paul Floyd wrote:
>
> > When I added
> >
> > VALGRIND_PRINTF("min %p %g %g", &min, min, _UNDEF);
> >
> > just before the supposed error site,
> >
> > a) the error went away
> > b) I didn't get any "%g" output (perhaps this is normal?)
>
> I don't know what the %g is supposed to do, but Valgrind's internal printf
> doesn't handle floats or doubles, and VALGRIND_PRINTF will also not handle
> arguments larger than word-size.
>
> What is _UNDEF? Could it be undefined?
Hi
I looked at the source a bit, and I saw that vprintf was being called, so I
assumed that it was using the C std lib version. %g should be for
floats/doubles, using an exponent for large/small values.
_UNDEF is defined, and is used as a 'magic number' to indicate an undefined
state.
Still, this looks like a false positive.
A+
Paul
|
|
From: Cerion Armour-B. <ce...@va...> - 2007-06-13 19:11:14
|
On Wednesday 13 June 2007 19:40, Paul Floyd wrote:
> Quoting Nicholas Nethercote <nj...@cs...>:
> > On Wed, 13 Jun 2007, Paul Floyd wrote:
> > > When I added
> > >
> > > VALGRIND_PRINTF("min %p %g %g", &min, min, _UNDEF);
> > >
> > > just before the supposed error site,
> > >
> > > a) the error went away
> > > b) I didn't get any "%g" output (perhaps this is normal?)
> >
> > I don't know what the %g is supposed to do, but Valgrind's internal
> > printf doesn't handle floats or doubles, and VALGRIND_PRINTF will also
> > not handle arguments larger than word-size.
> >
> > What is _UNDEF? Could it be undefined?
>
> Hi
>
> I looked at the source a bit, and I saw that vprintf was being called, so I
> assumed that it was using the C std lib version. %g should be for
> floats/doubles, using an exponent for large/small values.
>
Valgrind has it's own internal printf implementation.
But the docs do seem to be lacking details of the supported formatting...
If you take a look at VG_(debugLog_vprintf), in m_debuglog.c, you'll see that
the following formatting flags are supported (a-la printf)
d,u,p,x,c,s
i.e. indeed, no floats/doubles supported.
> _UNDEF is defined, and is used as a 'magic number' to indicate an undefined
> state.
>
> Still, this looks like a false positive.
>
> A+
> Paul
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Valgrind-users mailing list
> Val...@li...
> https://lists.sourceforge.net/lists/listinfo/valgrind-users
|
|
From: Julian S. <js...@ac...> - 2007-06-18 11:19:43
|
If this is indeed a bug in Memcheck, it will tend to be very
dependent on the specifics of gcc's code generation. Without
a small test case there's not a lot I can do to chase it down.
J
On Monday 11 June 2007 16:58, Paul Floyd wrote:
> Hi
>
> We're getting a "Conditional jump or move depends on uninitialised
> value(s)" error detected in the following code
>
> if ((min != _UNDEF) && (max != _UNDEF)) { /* NO ERROR HERE ?? */
> if (min > max) {
> toto = min;
> min=max;
> max = toto;
> }
> }
> wave->upd_minmax = 0;
> if (min == _UNDEF) { /* ERROR HERE */
> wave->upd_minmax = 1;
> wave->min_wave = loc_main_header->undef;
> }
> else {
> wave->min_wave = min;
> }
>
> if (max == _UNDEF) { /* ANOTHER ERROR HERE */
> wave->upd_minmax = 1;
> wave->max_wave = loc_main_header->undef;
> }
> else {
> wave->max_wave = max;
> }
>
> min and max are double formal parameters, which come from a call 2 levels
> higher, where the actual parameters are macro instances.
>
> I really can't see why Valgrind detects an error. Unfortunately, I haven't
> been able to reproduce this with a smaller testcase (the app under test is
> ~1M LOC).
>
> Any ideas where I can look, or shall I just put this one on the
> suppressions file?
>
> A+
> Paul
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Valgrind-users mailing list
> Val...@li...
> https://lists.sourceforge.net/lists/listinfo/valgrind-users
|