As the subject says. Take this:
-------------------------
namespace {
  void f() {}
}

int main () {
  f();
}
-------------------------
and then do this:

g/x> c++ -fprofile-generate x.cc ; ./a.out
g/x> c++ -fprofile-use x.cc
x.cc: In function 'void<unnamed>::f()':
x.cc:6: error: coverage mismatch for function
'_ZN33_GLOBAL__N_x.cc_00000000_3836C1911fEv' while reading counter 'arcs'
x.cc:6: error: checksum is 87e5f01 instead of fec92a63

This is due to the fact that gcc mangles anonymous namespace members with
different names every time it compiles the file. -fprofile-use should take
that into account.

Note that some libstdc++ has some anonymous namespaces. Consequently, some
programs that use libstdc++ will not be able to use -fprofile-generate/use
and there is nothing a program author can do about it.

Best
 W.


-- 
           Summary: -fprofile-generate/use and C++ anonymous namespaces
                    don't mix
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bangerth at dealii dot org


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

Reply via email to