On Mon, Feb 1, 2010 at 5:22 PM, jody <[email protected]> wrote:

> I accidentally replied tpo Julian only.
> Here it is for the list.
>  Sorry, jody
>
> ---------- Forwarded message ----------
> From: jody <[email protected]>
> Date: Mon, Feb 1, 2010 at 3:21 PM
> Subject: Re: [Valgrind-users] variable goes uninitialized after
> 'return' of method
> To: Julian Seward <[email protected]>
>
>
> Thank you for your replies
>
> I did run it with 'track-origins=yes' and the culprit was indeed the
> array m_apVegetation.
>
> But if m_apVegetation[id] is uninitialized, shouldn't it be reported
> as such in the if statement below at line 273 (after this uninitialized
> value has been saved in pAgent)?
>

Section 5.3 of the FAQ has the answer:
http://valgrind.org/docs/manual/faq.html#faq.undeferrors

--kcc


> Or do i misunderstand something on how these uninitialized values behave?
>
> Thank you
>  Jody
>
> On Mon, Feb 1, 2010 at 2:55 PM, Julian Seward <[email protected]> wrote:
> >
> >> The method used in line 611 is in a different class:
> >>     267:Agent *Cell::getVegAgent(spcid id) const {
> >>     268:  Agent *pAgent = NULL;
> >>     269:  if (id < NUM_VEG) {
> >>     270:      pAgent = m_apVegetation[id];
> >>     271:  }
> >>     272:  // this is to check for uninitialized
> >>     273:  if (pAgent == NULL) {
> >>     274:      pAgent = NULL;
> >>     275:  }
> >>     276:  return pAgent;
> >>     277:}
> >>
> >> When i run my application with valgrind, the first error to appear is:
> >> ==16915== Conditional jump or move depends on uninitialised value(s)
> >> ==16915==    at 0x815A0ED:
> >> AgentPacker::updateVegiAgentFromArray2(float*, Population const*,
> >> unsigned int) (AgentPacker.cpp:613)
> >>
> >> I inserted various if-statem,ents in the code above to "catch"
> >> uninitialized variables,
> >> but the ' if (pAgent != NULL) {' is the only one that triggers a
> >> 'Conditional jump ..' message from valgrind.
> >> It looks like pAgent goes uninitialized between return statement line
> >> 276 in the second class and
> >> the call in line 611.
> >
> > I would guess m_apVegetation[id] is uninitialised.
> >
> > Try --track-origins=yes for Valgrind.  That might help show
> > where the root cause of the problem is.
> >
> > J
> >
>
>
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the
> business
> Choose flexible plans and management services without long-term contracts
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com
> _______________________________________________
> Valgrind-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/valgrind-users
>
>
>
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to