Hi,

The following piece of code, gives "undefined references" to
__real_malloc, __real_free, etc.:

// references.cc
#include <cstdlib>

void func(int& x) {
  x = 0;
}

int main()  {
  int* p = NULL;
  func(*p);
}

Compiled with:
g++ -fmudflap references.cc -lmudflap

/lib64/libmudflap.a(mf-runtime.o): In function `__mfu_check':
../libmudflap/mf-runtime.c:912: undefined reference to `__real_malloc'
../libmudflap/mf-runtime.c:1028: undefined reference to `__real_free'
../lib64/libmudflap.a(mf-runtime.o): In function `__mf_insert_new_object':
../libmudflap/mf-runtime.c:1074: undefined reference to `__real_calloc'
../lib64/libmudflap.a(mf-runtime.o): In function `__mfu_unregister':
../libmudflap/mf-runtime.c:1430: undefined reference to `__real_free'
../libmudflap/mf-runtime.c:1433: undefined reference to `__real_free'
etc.

My system is Debain 6.0, here is how gcc-4.7.2 was configured:

Target: x86_64-unknown-linux-gnu
Configured with: ../configure
--prefix=/home/bdsatish/foss/installed/gcc --enable-languages=c,c++
--disable-multilib --disable-multiarch --enable-checking=runtime
--enable-libmudflap --enable-libgomp --disable-bootstrap
--enable-static --disable-shared --disable-decimal-float
--with-system-zlib --disable-libitm
--disable-build-poststage1-with-cxx --disable-build-with-cxx
--without-cloog --without-ppl --disable-nls --enable-threads
--enable-__cxa_atexit
Thread model: posix
gcc version 4.7.2 (GCC)

I think this is a bug or regression, I asked in freenode#gcc and hence
reporting here instead of gcc-help.
Thanks for the understanding.

Regards,
Satish

Reply via email to