public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/10180: gcc fails to warn about non-inlined function
@ 2003-03-21 11:56 wwieser
0 siblings, 0 replies; only message in thread
From: wwieser @ 2003-03-21 11:56 UTC (permalink / raw)
To: gcc-gnats
>Number: 10180
>Category: c++
>Synopsis: gcc fails to warn about non-inlined function
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Mar 21 11:56:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: wwieser@gmx.de
>Release: 3.2 (release), 3.2.3 (prerelease) and others
>Organization:
>Environment:
Linux ix86
>Description:
Try compiling the following code:
--------<test.cpp>--------
static inline int foo(int x);
int main()
{
return(foo(17));
}
inline int foo(int x)
{ return(x); }
--------------------------
Compiling it with gcc-2.95 gives:
bash# gcc -s -O2 -Winline test.cc
test.cc: In function `int main()':
test.cc:1: warning: can't inline call to `int foo(int)'
test.cc:5: warning: called from here
...which is what you would expect.
Compiling it with gcc-3.2 results in:
bash# gcc -Winline -S -O2 test.cc
bash#
...nothing.
However, looking at the assembler code:
--------<test.s>---------
...
main:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
andl $-16, %esp
movl $17, (%esp)
call _Z3fooi <-------
movl %ebp, %esp
popl %ebp
ret
...
---------------------
reveales that the function foo() actually was NOT inlined.
I thought, gcc-3 was finally clever enough to perform inlining
of functions which are declared inline before but defined after
a calling location. If it cannot, it should at least issue the
requested warning.
>How-To-Repeat:
See above.
>Fix:
Ugh... If I had any clue about gcc code...
At least gcc-2.95 still warns correctly :)
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-03-21 11:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-21 11:56 c++/10180: gcc fails to warn about non-inlined function wwieser
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).