This is the mail archive of the gcc-bugs@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]

[Bug c/26864] New: multithreaded mudflap not working


gcc version: 
gcc (GCC) 4.0.2 20051125 (Red Hat 4.0.2-8)

Sample program t1.c:
int main()
{
   int a[3] = { 1, 2, 3 };
   return a[3];
}

When I compile this with mudflap, it correctly reports an error:
$ gcc -fmudflap t1.c -lmudflap
$ a.out
*******
mudflap violation 1 (check/read): time=1143264091.275264 ptr=0xbf97b680 size=16
pc=0x5e8373 location=`s3.c:4 (main)'
      /usr/lib/libmudflap.so.0(__mf_check+0x44) [0x5e8373]
      a.out(main+0xa1) [0x8048751]
      /usr/lib/libmudflap.so.0(__wrap_main+0x1d8) [0x5e90be]
Nearby object 1: checked region begins 0B into and ends 4B after
mudflap object 0x8712380: name=`s3.c:3 (main) a'
bounds=[0xbf97b680,0xbf97b68b] size=12 area=stack check=3r/0w liveness=3
alloc time=1143264091.275229 pc=0x5e8e7a
number of nearby objects: 1

The manual recommends using -fmudflapth for multithreaded programs.  One thing
in the man page/online manual that is not clear is whether to link with
libmudflap or libmudflapth for multithreaded program.  Both libraries exist but
only libmudflap is mentioned in the manual.  This should be clarified.

In any case, when I link with either -lmudflap or -lmudflapth and compile with
-fmudflapth, a.out gives no output at all.

$ gcc -pthread -fmudflapth t1.c -lmudflapth
[ omitted irrelevant warnings about deprecated pthread_attr_getstackaddr ]
$ a.out
[ no output at all ]

$ gcc -pthread -fmudflapth t1.c -lmudflap
[ same ]
$ a.out
[ no output ]


-- 
           Summary: multithreaded mudflap not working
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pr2345 at gmail dot com
 GCC build triplet: same
  GCC host triplet: Linux 2.6 i386
GCC target triplet: same


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26864


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