https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64875

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2017-08-22
                 CC|                            |egallager at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |daniel.gutson at intel 
dot com
     Ever confirmed|0                           |1

--- Comment #3 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Daniel Gutson from comment #0)
> The following code misses the warning:
> 
> #include <iostream>
> 
> struct PP
> {
>       inline void m();
> };
> 
> int main()
> {
>       PP pp;
>       pp.m();
> }
> 
> inline void PP::m()
> {
>       std::cout << "hola" << std::endl;
> }
> 
> Invoke:
>   g++ -Wall -Wextra -pedantic -ggdb3 -std=c++11 -Winline winline.cpp
> No warnings emitted.
> 
> However:
> 
> objdump -dC ./a.out |grep "PP"
>   40086c:     e8 59 00 00 00          callq  4008ca <PP::m()>
> 00000000004008ca <PP::m()>:
> 
> If no one is available, assign this to me (though I'm not sure when I will
> have time to address this).

OK.

(In reply to Daniel Gutson from comment #2)
> inline is as useful in c++ as in C regardless of ODR or any other reason but
> its original purpose: performance. I want to know when my hint is not honored
> which is the exact intent of this warning.

If you use an optimization flag the 'inline' is honored:

$ /usr/local/bin/g++ -Wall -Wextra -pedantic -ggdb3 -std=c++11 -Winline -o
64975_O0.exe 64975.cc
$ objdump -dC ./64975_O0.exe | grep "PP"
    1e88:       e8 b3 11 00 00          call   3040 <_ZN2PP1mEv$stub>
00001f0e <PP::m()>:
00003040 <_ZN2PP1mEv$stub>:
$ /usr/local/bin/g++ -Wall -Wextra -pedantic -ggdb3 -std=c++11 -Winline -O1 -o
64975_O1.exe 64975.cc
$ objdump -dC ./64975_O1.exe | grep "PP"

So maybe mention optimizing in the warning if you add one.

Reply via email to