mudflap: how do I give size for 'void *' objects? - example
Eyal Lebedinsky
eyal@eyal.emu.id.au
Sat Apr 5 11:18:00 GMT 2003
Eyal Lebedinsky wrote:
>
> I have a problem where I get a large number of reported violations
> when accessing objects acquired through something like
> p = shmat()
> where the size of the object is unknown (unless mudflap uses
> extra internal knowledge).
Here is a simple program that demonstrates the problem with ctime().
Note how the fprintf() works OK (no violation) but the strlen()
fails. I assume that mudflap has its own strlen() wrapper that
trips on the "foreign" pointer returned from ctime().
-----------------------------------------------------
#!/bin/sh
mf="/usr/local/gcc-mudflap"
cat >zz.c <<EOF
#include <stdio.h>
#include <time.h>
#include <string.h>
int main ()
{
time_t t;
char *p;
int l;
t = time (NULL);
p = ctime (&t);
fprintf (stderr, "%s", p);
l = (int)strlen (p);
return (0);
}
EOF
export LD_LIBRARY_PATH="$mf/lib"
cc="$mf/bin/i686-pc-linux-gnu-gcc-3.5-tree-ssa -fmudflap -g -O0"
#cc="gcc"
test -f zz && rm zz
$cc -Wall -o zz zz.c
./zz
-----------------------------------------------------
--
Eyal Lebedinsky (eyal@eyal.emu.id.au) <http://samba.org/eyal/>
More information about the Gcc
mailing list