public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/16922] New: gcc inlines functions with attribute noinline
@ 2004-08-08 19:21 wwieser at gmx dot de
  2004-08-08 19:24 ` [Bug c++/16922] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 4+ messages in thread
From: wwieser at gmx dot de @ 2004-08-08 19:21 UTC (permalink / raw)
  To: gcc-bugs

Well, so this tricked me in some function call time measurements:  
 
In the following code... 
 
----------<test.cc>----------------------------- 
int foo(int x) __attribute__((noinline)); 
int main() 
{ 
	for(int i=0; i<0x7fffffff; i++) 
		foo(i); 
} 
 
int foo(int x)  {  return(x);  } 
------------------------------------------------ 
 
...the function foo() actually gets inlined when compiled with  
 
  g++ -O2 -fno-rtti -fno-exceptions test.cc -o test.S 
 
as can be seen in the produced assembler code 
 
[...] 
main: 
	pushl	%ebp 
	xorl	%eax, %eax 
	movl	%esp, %ebp 
	subl	$8, %esp 
	andl	$-16, %esp 
	subl	$16, %esp 
	.p2align 4,,15 
.L6:                                 <-- loop start 
	incl	%eax 
	cmpl	$2147483647, %eax 
	jne	.L6                  <-- loop end 
[...] 
 
The "call foo" is missing and got optimized away.  
 
Version in question:  
  ggc (GCC) 3.4.2 20040808 (prerelease) 
 
Wolfgang

-- 
           Summary: gcc inlines functions with attribute noinline
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: wwieser at gmx dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-linux-gnu
  GCC host triplet: i686-linux-gnu
GCC target triplet: i686-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16922


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-29 20:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-16922-4@http.gcc.gnu.org/bugzilla/>
2023-01-29 20:23 ` [Bug c++/16922] gcc inlines functions with attribute noinline pinskia at gcc dot gnu.org
2023-01-29 20:23 ` pinskia at gcc dot gnu.org
2023-01-29 20:24 ` pinskia at gcc dot gnu.org
2004-08-08 19:21 [Bug c++/16922] New: " wwieser at gmx dot de
2004-08-08 19:24 ` [Bug c++/16922] " pinskia at gcc dot gnu dot org

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).