public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* mudflapth not working
@ 2006-06-29 9:36 Stuart Clarke
0 siblings, 0 replies; only message in thread
From: Stuart Clarke @ 2006-06-29 9:36 UTC (permalink / raw)
To: gcc-bugs
Hi all,
First submission to this list, so go easy on me. I've the following
file (temp.cc):
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
int foo_static[] = {0, 0};
void* run(void* arg)
{
int foo[] = {0, 0};
printf("foo[2]: %d\r\n", foo[2]);
printf("foo_static[2]: %d\r\n", foo_static[2]);
}
int main(void)
{
pthread_t thread;
pthread_attr_t attributes;
pthread_attr_init(&attributes);
pthread_create(&thread, &attributes, &run, 0);
for (;;) {
sleep(1);
}
return 0;
}
And I conduct the following transaction with my computer:
beef@nono:~$ set | fgrep MUDFLAP
MUDFLAP_OPTIONS='-mode-check --viol-segv'
beef@nono:~$ g++ -fmudflapth -fmudflap temp.cc -lmudflapth -lpthread
beef@nono:~$ ./a.out
foo[2]: -1209174832
*******
mudflap violation 1 (check/read): time=1151571511.357805 ptr=0x80c9168
size=12
pc=0xb7ec5a30 location=`temp.cc:13 (run)'
/usr/lib/libmudflapth.so.0(__mf_check+0x50) [0xb7ec5a30]
./a.out(_Z3runPv+0x1f0) [0x8048be2]
/usr/lib/libmudflapth.so.0 [0xb7ed3a53]
Nearby object 1: checked region begins 0B into and ends 4B after
mudflap object 0x80ca2e8: name=`temp.cc:6 int foo_static [2]'
bounds=[0x80c9168,0x80c916f] size=8 area=static check=3r/0w liveness=3
alloc time=1151571511.288349 pc=0xb7ec53f0 thread=3083183808
number of nearby objects: 1
Segmentation fault
beef@nono:~$
As you can see, only the indexing of foo_static caused a violation, not
the indexing of foo. If foo were in main()'s stack, however, it would
have caused a violation.
Versions of stuff as follows:
beef@nono:~$ gcc --version
gcc (GCC) 4.1.2 20060613 (prerelease) (Debian 4.1.1-5)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
beef@nono:~$ uname -a
Linux nono 2.6.15.6 #2 Thu Mar 9 17:34:11 EST 2006 i686 GNU/Linux
beef@nono:~$
I've tried to compile 4.1.0 from a GNU mirror, but with the same result.
Can anyone shed some light on this?
Thanks,
Stuart
--
Stuart Clarke <sjclarke@tpg.com.au>
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-06-29 9:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-29 9:36 mudflapth not working Stuart Clarke
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).