This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/62282] [4.8/4.9/5 Regression] Undefined reference with __inline __attribute(__gnu_inline__) with -O0
- From: "dmitry.petroff at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 02 Sep 2014 11:48:36 +0000
- Subject: [Bug c++/62282] [4.8/4.9/5 Regression] Undefined reference with __inline __attribute(__gnu_inline__) with -O0
- Auto-submitted: auto-generated
- References: <bug-62282-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62282
--- Comment #11 from Dmitry Petrov <dmitry.petroff at gmail dot com> ---
>Which of the above mentioned semantics you want for your inlines?
Semantics that would allow me get code that links even with -O0 without need to
dublicate function body.
I can understand how this code can produce an undefined reference:
// === cut ===
__inline
__attribute__ ((__gnu_inline__))
int test(int v)
{
return v;
}
int main(int argc, char **argv)
{
return test(argc);
}
// === cut ===
With -O0 gcc is not inlining, then __inline + gnu_inline comes into play by
prohibiting generation test's body. So there's main function that has "call
U(_Z4testi)" instruction but there's no way to actually get test address. That
is logical, but insane.
Is there an easy way to get debugger-friendly (-O0) compiler output other than
provide an exact function copy but without __inline
__attribute__((__gnu_inline__))?
>From what I see, I have to pipe gperf's output to sed -e
's/__gnu__inline__/\0,__always_inline__/', but this seems so ugly that GNU
tools cannot cooperate with each other.