[Bug c++/48525] -O0 produces incorrect results for inlined functions sharing the same name.
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Apr 9 09:52:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48525
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-04-09 09:52:01 UTC ---
(In reply to comment #0)
> When compiling multiple files with inline functions which share the same
> signature and name -O0 produces results inconsistent with -O1, -O2, and -O3
> (which produce the expected result).
As Andreas said, this is an One Definition Rule violation, you need to make the
functions static or put them in an anonymous namespace if you want to have a
different definition in each file.
> gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)
This compiler is not supported by the GCC project, the oldest supported release
is 4.3
You should report issues with your compiler to Apple.
More information about the Gcc-bugs
mailing list