[Bug libmudflap/27526] New: mudflap mishandles mmap when compiled -D_FILE_OFFSET_BITS=64

trt at acm dot org gcc-bugzilla@gcc.gnu.org
Tue May 9 20:35:00 GMT 2006


On a SLES9 box, the program below compiles and runs fine when compiled with
-fmudflap -lmudflap (annoying redundancy, that).  But when compiled with `large
files' enabled: -fmudflap -lmudflap -D_FILE_OFFSET_BITS=64 the munmap results
in 256 complaints (256*4096 == one megabyte):

mudflap violation 1 (unregister): time=1147206201.931785 ptr=0x40230000
size=4096
pc=0x4001ed26
      /opt/gcc42t/lib/libmudflap.so.0(__mf_unregister+0x36) [0x4001ed26]
      /opt/gcc42t/lib/libmudflap.so.0(munmap+0xf0) [0x40021260]


The reason seems to be the the D_FILE_OFFSET_BITS=64 causes mmap2() to be
called instead, and that seems to be unsupported by mudflap.

  #include <stdio.h>
  #include <sys/types.h>
  #include <sys/mman.h>

  int main ()
  {
    void *storage;
    long  allocsize = 1024*1024;

    storage = mmap(0, allocsize, PROT_READ | PROT_WRITE,
                   MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);

    if (storage == MAP_FAILED)
      perror("mmap");

    munmap(storage, allocsize);

    return 0;
  }


-- 
           Summary: mudflap mishandles mmap when compiled -
                    D_FILE_OFFSET_BITS=64
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libmudflap
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: trt at acm dot org
 GCC build triplet: i686-pc-linux


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



More information about the Gcc-bugs mailing list