This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/48525] -O0 produces incorrect results for inlined functions sharing the same name.


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

Dmitry Gorbachev <d.g.gorbachev at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |d.g.gorbachev at gmail dot
                   |                            |com

--- Comment #4 from Dmitry Gorbachev <d.g.gorbachev at gmail dot com> 2011-04-09 21:08:05 UTC ---
> Would it not be prudent for g++ to at least emit a
> warning when the ODR is violated in cases like this?

Gold (a linker) can detect such cases:

$ g++ main.cpp double.cpp square.cpp -Wall -O0  -g -Wl,--detect-odr-violations
/usr/local/bin/ld: warning: while linking a.out: symbol 'sharedname(int)'
defined in multiple places (possible ODR violation):
  square.cpp:2 from /tmp/ccwt9DKt.o
  double.cpp:2 from /tmp/ccb8pMLx.o


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]