This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/41194] __attribute__ ((__gnu_inline__)) yields undefined reference when compiled with -O0, but not with -O1
- From: "jonny+bg at mail dot hfa3 dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 31 May 2010 23:41:47 -0000
- Subject: [Bug c++/41194] __attribute__ ((__gnu_inline__)) yields undefined reference when compiled with -O0, but not with -O1
- References: <bug-41194-18123@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from jonny+bg at mail dot hfa3 dot org 2010-05-31 23:41 -------
For clarity, a smaller test is: __inline __attribute__ ((gnu_inline)) void
func () { } int main() { func(); return 0; } $ g++ foo.cpp /tmp/cc31L8fw.o: In
function `main': foo.cpp:(.text+0x5): undefined reference to `func()' collect2:
ld returned 1 exit status Most people who hit this bug are likely using gperf.
$ gperf -N func . . . #ifdef __GNUC__ __inline #if defined
__GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ __attribute__
((__gnu_inline__)) #endif #endif const char * func (str, len) . . . $ gperf -N
func -L C++ # will and avoid this bug :-) but also renames func to
Perfect_Hash::func :-(
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41194