This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

mudflap question


Why do I get different behavior when I compile and run hello.cpp (see below) two different
ways:


g++f4 -c -fmudflap -o hello.o hello.cpp ; g++f4 -o hello hello.o -lmudflap
g++f4 -fmudflap -o hello hello.cpp -lmudflap

When I compile the first way, I get mudflap warnings when I access argv[0] and errno; when I compile the second way, mudflap is silent. Should I expect to see mudflap warnings with errno accesses? I have an application that accesses it frequently so I get a huge number of warnings.

Thanks...

David

PS - I was using gcc from svn from 2006-02-03.

#include <stdio.h>
#include <errno.h>

int main(int argc, char *argv[])
{
 errno = 1;
 printf("%d %s\n", errno, argv[0]);

 printf("Hello, world!\n");
 return 0;
}


{65} g++f4 -c -fmudflap -o hello.o hello.cpp ; g++f4 -o hello hello.o -lmudflap
{66} ./hello
*******
mudflap violation 1 (check/write): time=1139021256.756465 ptr=0xb7e926a0 size=4
pc=0xb7ebc322 location=`hello.cpp:6 (main)'
/usr/lib/libmudflap.so.0(__mf_check+0x44) [0xb7ebc322]
./hello(main+0x92) [0x8048776]
/lib/tls/libc.so.6(__libc_start_main+0xd3) [0xbdae23]
number of nearby objects: 0
*******
mudflap violation 2 (check/read): time=1139021256.757309 ptr=0xbf898d64 size=4
pc=0xb7ebc322 location=`hello.cpp:7 (main)'
/usr/lib/libmudflap.so.0(__mf_check+0x44) [0xb7ebc322]
./hello(main+0x117) [0x80487fb]
/lib/tls/libc.so.6(__libc_start_main+0xd3) [0xbdae23]
number of nearby objects: 0
*******
mudflap violation 3 (check/read): time=1139021256.757390 ptr=0xb7e926a0 size=4
pc=0xb7ebc322 location=`hello.cpp:7 (main)'
/usr/lib/libmudflap.so.0(__mf_check+0x44) [0xb7ebc322]
./hello(main+0x1a0) [0x8048884]
/lib/tls/libc.so.6(__libc_start_main+0xd3) [0xbdae23]
number of nearby objects: 0
1 ./hello
Hello, world!
{67} g++f4 -fmudflap -o hello hello.cpp -lmudflap
{68} ./hello
1 ./hello
Hello, world!


_________________________________________________________________
On the road to retirement? Check out MSN Life Events for advice on how to get there! http://lifeevents.msn.com/category.aspx?cid=Retirement



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]