Using libmudflap to test a program that uses libxml2, I found that if
a program access a constant pointer in a non-instrumented library,
mudflap thinks that a read violation has occurred.
A simple test that illustrates this is:
a.c:
-
char *p = abc;
rafael.espindola wrote:
[...]
extern char *p;
[...]
char a = p[0];
[...]
compile and link with
gcc -shared -fPIC a.c -o liba.so
gcc -fmudflap -lmudflap b.c -la -L. -o b
Did the compiler give you a warning about inability to track the
lifetime of p? It should have.
- FChE
Did the compiler give you a warning about inability to track the
lifetime of p? It should have.
No. Not even with -Wall -O2.
gcc -v:
gcc (GCC) 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9)
- FChE
Thanks,
Rafael