This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/48525] -O0 produces incorrect results for inlined functions sharing the same name.
- From: "d.g.gorbachev at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 9 Apr 2011 21:08:12 +0000
- Subject: [Bug c++/48525] -O0 produces incorrect results for inlined functions sharing the same name.
- Auto-submitted: auto-generated
- References: <bug-48525-4@http.gcc.gnu.org/bugzilla/>
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