mudflap warning: unaccessed registered object:
Christoph Bartoschek
bartoschek@or.uni-bonn.de
Fri Aug 18 13:00:00 GMT 2006
Hi,
I tried mudflap on the following simple program, that has no errors as far as
I can see this:
#include <malloc.h>
#include <stdio.h>
void print(int * a) {
printf("%d\n", *a);
}
int main (void) {
int * a = malloc(sizeof(int));
*a = 2;
print(a);
free(a);
return 0;
}
Here is the result of mudflap after compiling with:
gcc mud.c -pthread -fmudflapth -lmudflapth
export MUDFLAP_OPTIONS="-print-leaks"
./a.out
2
*******
mudflap warning: unaccessed registered object:
mudflap dead object 0x804cce0: name=`malloc region'
bounds=[0x804cc98,0x804cc9b] size=4 area=heap check=0r/0w liveness=0
alloc time=1155905084.555647 pc=0xb7e124b0 thread=3083499184
/home/devel/software/gcc/lib/libmudflapth.so.0(__mf_register+0x50)
[0xb7e124b0]
/home/devel/software/gcc/lib/libmudflapth.so.0(__real_malloc+0xf2)
[0xb7e13b22]
./a.out(main+0x1d) [0x804865e]
/home/devel/software/gcc/lib/libmudflapth.so.0(__wrap_main+0x49)
[0xb7e12579]
dealloc time=1155905084.556104 pc=0xb7e123d9 thread=3083499184
/home/devel/software/gcc/lib/libmudflapth.so.0(__mf_unregister+0x49)
[0xb7e123d9]
/home/devel/software/gcc/lib/libmudflapth.so.0(__real_free+0xad)
[0xb7e132ed]
./a.out(main+0x3f) [0x8048680]
/home/devel/software/gcc/lib/libmudflapth.so.0(__wrap_main+0x49)
[0xb7e12579]
number of leaked objects: 0
In our real multithreaded programm we get tons of such messages. What is the
error shown here? And how to prevent it?
When I compile the test programm without threads it works fine, but this is no
option for the real programm. The gcc version:
gcc (GCC) 4.1.1
Greetings
Christoph Bartoschek
More information about the Gcc-help
mailing list