[Bug c++/62282] [4.8/4.9/5 Regression] Undefined reference with __inline __attribute(__gnu_inline__) with -O0
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Sep 2 10:47:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62282
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
Resolution|--- |INVALID
--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Dmitry Petrov from comment #9)
> Jakub, so you telling that different behaviour of gcc and g++ is ok in this
> case?
Yes.
> With gcc inline + gnu_inline does not yields undefined references.
C++ has one inline semantics, C99 another one (different from C++), GNU89
another one. So, why do you expect some consistency?
The gnu_inline attribute allows to tweak what semantics it is.
In C99 mode, where since 4.3 the default is the C99 semantics, gnu_inline
attribute tells the compiler to use GNU89 inline semantics anyway. That
semantics is about all of inline, extern inline, static inline and various
combinations of those on duplicate declarations/definitions.
In C++ mode, all we needed was the GNU89 extern inline semantics, so the
gnu_inline attribute in C++ is about that.
> And before you advice me to not use such constructions in my code, please
> note that problem appears in gperf output. So people have to use ugly #undef
> workarounds or even more ugly sed tricks or just don't use gperf's C output
> with g++ when debugging.
Why don't you emit it conditional on __cpluplus macro or similar?
Which of the above mentioned semantics you want for your inlines?
> And I'm sorry to be that insistent but
> >G++ 4.3 was the first release to support gnu_inline attribute in C++
> is not true: g++-4.1 supported gnu_inline at some point:
> http://www.redhat.com/archives/fedora-extras-commits/2007-September/msg00089.
> html
4.1 doesn't support it in C++ mode, only some vendor compilers like 4.1-RH
(perhaps others) have some changes backported. Vanilla 4.1 was the first gcc
version to support it in C mode though.
More information about the Gcc-bugs
mailing list