[Bug lto/56578] Testcase behaves differently when compiled with LTO

d.g.gorbachev at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Mar 12 13:30:00 GMT 2013


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?



More information about the Gcc-bugs mailing list