The following two build commands yield executables with different mudflap behavior, which seems like a bug to me:
g++ -c -fmudflap -o hello.o hello.cpp ; g++f4 -o hello hello.o -lmudflap g++ -fmudflap -o hello hello.cpp -lmudflap Here's the source for hello.cpp: #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; } Using gcc from svn from 2006-02-03: {65} g++ -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++ -fmudflap -o hello hello.cpp -lmudflap {68} ./hello 1 ./hello Hello, world! I built on a P4 running Fedora Core 3 with the svn version of gcc. -- Summary: mudlap behavior changes with trivial changes to build command Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: idht4n at hotmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26120