Testcase:

  $ cat x.cc
  struct desc {
    const char *Desc;
    desc(const char *Str) : Desc(Str) {}
  };

  struct opt {
    explicit opt(const desc &d) {}
  };

  opt o(desc("Do something!"));

  int main(void) {}

Reproduce:

  $ g++-4.4 x.cc -fmudflap -lmudflap -o x
  $ ./x
  *******
  mudflap violation 1 (check/write): time=1252042304.148291 ptr=0xffe13fbc
size=4
  pc=0xf7ddb38d location=`x.cc:3:35 (desc::desc)'
        /usr/lib/libmudflap.so.0(__mf_check+0x3d) [0xf7ddb38d]
        ./x(_ZN4descC1EPKc+0x6a) [0x8048996]
        ./x [0x80488a6]
  number of nearby objects: 0

I don't know why this is happening. It goes away if you remove 'opt' and try to
just say 'decl d("Foo"));' as a global.


-- 
           Summary: mudflap complains about c++ temporary passed in to
                    global ctor
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: nicholas at mxc dot ca
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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

Reply via email to