On Thu, Feb 3, 2011 at 6:43 AM, Julian Seward <[email protected]> wrote:
> > >> No, he is passing that struct as mtext.
> > >>
> > >> The problem is that the struct has padding, which he won't be
> > >> initialising.
> > >
> > > I assume he memsets the whole struct, so padding should also be
> > > initialized?
> >
> > Why would you presume that? I would say that it's pretty clear that he
> > isn't, or he wouldn't get the warning from valgrind!
>
> Well, he did say that in the original msg, although it's ambiguous.
> If the whole struct is memset-0'd then the padding should all be
> initialised. memset-0-ing the fields individually obviously won't
> help.
>
> Steve, try (1) memset-0-ing the entire structure, and (2) using
> --track-origins=yes
Thanks for the replies everyone! To answer the earlier questions, yes I am
passing the struct as mtext and yes I am memset-ing to 0 the entire
structure so any padding should be automatically zero'd out.
Here's a code fragment:
memset (&my_message, 0x00, sizeof (f_msg));
my_message.mtype = 1;
my_message.quit_type = quitID;
my_message.quit_msg = NULL;
my_message.prolong = 7;
my_message.prolong_count = get_p_ct (local_prolong);
my_message.prolong_type = get_p_type (local_prolong);
Running with track-origins=yes results in a line number that points to the
static declaration of my_message at the beginning of the function.
==2662== Uninitialised value was created by a stack allocation
Now for the interesting part! It looks like the problem is restricted to
the older version of my cross compiler. When I switch to a newer version, I
don't see the same warning from valgrind. Thanks again for all your help!
------------------------------------------------------------------------------
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world?
http://p.sf.net/sfu/oracle-sfdevnlfb
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users