public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dmitry.petroff at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/62282] [4.8/4.9/5 Regression] Undefined reference with __inline __attribute(__gnu_inline__) with -O0
Date: Tue, 02 Sep 2014 11:48:00 -0000	[thread overview]
Message-ID: <bug-62282-4-NAYtIjdAID@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-62282-4@http.gcc.gnu.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.


      parent reply	other threads:[~2014-09-02 11:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-27 11:38 [Bug c++/62282] New: " dmitry.petroff at gmail dot com
2014-08-27 11:54 ` [Bug c++/62282] " rguenth at gcc dot gnu.org
2014-08-27 16:28 ` pinskia at gcc dot gnu.org
2014-08-28 10:52 ` dmitry.petroff at gmail dot com
2014-08-28 12:26 ` [Bug c++/62282] [4.8/4.9/5 Regression] " rguenth at gcc dot gnu.org
2014-08-28 12:27 ` rguenth at gcc dot gnu.org
2014-09-01  9:18 ` jakub at gcc dot gnu.org
2014-09-01 12:10 ` jakub at gcc dot gnu.org
2014-09-01 12:20 ` jakub at gcc dot gnu.org
2014-09-02 10:34 ` dmitry.petroff at gmail dot com
2014-09-02 10:47 ` jakub at gcc dot gnu.org
2014-09-02 11:48 ` dmitry.petroff at gmail dot com [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-62282-4-NAYtIjdAID@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).