Yesterday I upgraded my fedora core 3 instalation and got gcc4 installed.
I tested the mudflap code and found a problem. The reduced test case is
below.

when I have two programs a.c and b.c
-- a.c --
typedef struct { char *name; } dummy;
dummy d[] = { {"a"}, {0} };

-- b.c --
typedef struct { char *name; } dummy;
extern dummy d[];

int
main (void)
{
  dummy *pd = d;

  while (pd->name)
    {
      printf ("%s\n", pd->name);
      pd++;
    }
}

and compile this with:
gcc4 -fmudflap a.c b.c -o a -lmudflap 

when I run the program I get:
a
*******
mudflap violation 1 (check/read): time=1113495140.046642 ptr=0x8049a00 size=4
pc=0xb7eff322 location=`b.c:9 (main)'
      /usr/lib/libmudflap.so.0(__mf_check+0x44) [0xb7eff322]
      ./a(main+0x8b) [0x8048787]
      /usr/lib/libmudflap.so.0(__wrap_main+0x1d8) [0xb7f0004e]
Nearby object 1: checked region begins 8B before and ends 5B before
mudflap object 0x80ca090: name=`__mf_lc_mask'
bounds=[0x8049a08,0x8049a0b] size=4 area=no-access check=0r/0w liveness=0
alloc time=1113495140.046375 pc=0xb7effe0a
Nearby object 2: checked region begins 16B before and ends 13B before
mudflap object 0x80ca028: name=`__mf_lookup_cache'
bounds=[0x8049a10,0x80c9a0f] size=524288 area=no-access check=0r/0w liveness=0
alloc time=1113495140.046371 pc=0xb7effe0a
number of nearby objects: 2

There should be no error.
I think the problem is in tree-mudflap.c in function mudflap_finish_file.
Here is a check for TREE_STATIC. I think this should be !TREE_PUBLIC ???

I assigned this to 4.0.1 because I probably can not assign this to 4.0.0
anymore?

-- 
           Summary: mudflap reports errors
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libmudflap
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hermantenbrugge at home dot nl
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-redhat-linux
  GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux


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

Reply via email to