http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56578
--- Comment #4 from Dmitry Gorbachev <d.g.gorbachev at gmail dot com> 2013-03-12 13:30:30 UTC --- > We could say the bug is in the testcase. Failing is: [...] > that's because you are providing an implementation of > malloc in libxxx.a a.o from func.c that does not have > the C standards semantics. The TC is invalid but it is not buggy, gcc-nm could not even find the "malloc" symbol in a.o > You have to compile this module with -fno-builtin-malloc > (or -fno-builtins). It is not enough to compile just func.c with -fno-builtin(-malloc), as one might expect. I have to use it for main.c as well. > GCC might still optimize the result in an unexpected way > because it can rely on malloc/free semantics There is a "volatile" modifier in the TC. It should inhibit such optimizations, I think?