On 12/10/2023 08:53, Paul Floyd wrote:
On 11/10/2023 23:47, Karl Robillard via Valgrind-users wrote:
I'm getting the following error on struct members which should absolutely be
initialized:
Conditional jump or move depends on uninitialised value(s)
To begin investigating I did a memset of zero on the entire struct and the
error goes away. Now this C++ struct inherits another one and the error is
reported in C code expecting the base struct. If I only memset the base
struct the error is still reported, which should be impossible.
Code summary of the weirdness:
struct ListDrawState : public DrawState { ... };
extern "C" void draw_func(DrawState*);
ListDrawState ds;
memset(&ds, 0, sizeof(DrawState)); // Error in draw_func()
I don't think that this is legal C++. You can't assume that a C++ class
object has the same kind of memory layout as a POD C struct.
That's not any part of the problem code though, so it's not
really relevant to the original problem.
There's no way we can comment on the original problem though
because we can't actually see any of the code, only a few top
level highlights which is nowhere near enough to tell us
anything about what is happening.
Tom
--
Tom Hughes (t...@compton.nu)
http://compton.nu/
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users