|
From: Grant S. <gs...@di...> - 2004-06-18 14:16:07
|
Odd issue here. I got this library supplied to me for tests. They define
and use a type "uint32", they have it typedef'ed as a "unsigned int"
which is 32 bits on this machine. Fine.
However, whenever I use that variable, valgrind gets upset and says I am
doing a "Invalid write of size 4" on that line. take this for example.
#//custom library include's are here..
int main()
{
uint32 value =3D 42; // <--we will call this line 10
...
return 0;
}
valgrind reports the Invalid write on line ten(see my comment).
Obviously this isn't a problem. So I am a bit confused as to why it is
reporting this. Any ideas on what I can look at?
System here is using the following config.
OS : Redhat 9
C Compiler : gcc 3.2.2
Valgrind : vagrind 2.1.1
The crazy thing here, is that see where I remove the "...", that is the
rest of the code that was received, there are a few functions defined
before it. If I remove all that code, valgrind doesn't report any
errors.
My first guess was I was getting the "wrong" line number for some
reason. However, if I add like 10 more definitions just like...
uint32 value1 =3D 42;
uint32 value2 =3D 42;
uint32 value2 =3D 42;
The number of "Invalid write size.." messages goes up for each line I
add. So I am thinking it really is complaining about this.
Something is funky here, not sure what to guess at. Any ideas of what to
look at?
-grant
=20
|
|
From: Nicholas N. <nj...@ca...> - 2004-06-21 09:16:34
|
On Fri, 18 Jun 2004, Grant Schoep wrote:
> Odd issue here. I got this library supplied to me for tests. They define
> and use a type "uint32", they have it typedef'ed as a "unsigned int"
> which is 32 bits on this machine. Fine.
>
> However, whenever I use that variable, valgrind gets upset and says I am
> doing a "Invalid write of size 4" on that line. take this for example.
>
> #//custom library include's are here..
>
> int main()
> {
> uint32 value = 42; // <--we will call this line 10
> ...
> return 0;
> }
>
> valgrind reports the Invalid write on line ten(see my comment).
> Obviously this isn't a problem. So I am a bit confused as to why it is
> reporting this. Any ideas on what I can look at?
>
> System here is using the following config.
>
> OS : Redhat 9
> C Compiler : gcc 3.2.2
> Valgrind : vagrind 2.1.1
>
> The crazy thing here, is that see where I remove the "...", that is the
> rest of the code that was received, there are a few functions defined
> before it. If I remove all that code, valgrind doesn't report any
> errors.
That sounds like important info -- there's not enough detail in your
description to debug this. Can you create a small stand-alone C program
(even better, assembly code program) that exhibits this behaviour?
N
|