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: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 28 Aug 2014 12:26:27 +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
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Known to work| |4.2.4
Resolution|INVALID |---
Target Milestone|--- |4.8.4
Summary|Undefined reference with |[4.8/4.9/5 Regression]
|__inline |Undefined reference with
|__attribute(__gnu_inline__) |__inline
|with -O0 |__attribute(__gnu_inline__)
| |with -O0
Known to fail| |4.3.6
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> Except it is not vague in general, the idea is that there is another
> definition somewhere of test and not just in this translation unit. Since we
> are at -O0, we decide not to inline it and it does not get emitted.
So with C++ 'inline __attribute__((__gnu_inline__))' is equivalent to
'extern inline __attribute__((__gnu_inline__))'? What's the reason for
that?
It seems it is at least inconsistent with pre-c99 inline semantic?
G++ 4.1 links the test just fine (G++ 4.3 already shows the bad behavior),
but G++ 4.1 also links 'extern inline' fine (but it doesn't inline).
At least it's very old behavior it seeems, but a regression from G++ 4.2
which knows the attribute but correctly preserves the function(?).
Note that the C frontend happily links the testcase as well, preserving
the function. That's an inconvenient difference between behavior of
C and C++ for an attribute that was introduced to provide backward
compatibility with pre-C99 inline semantics.