[Bug optimization/11830] Unnecessary call to an empty function

rearnsha at arm dot com gcc-bugzilla@gcc.gnu.org
Wed Aug 6 12:49:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From rearnsha at arm dot com  2003-08-06 12:49 -------
Subject: Re:  Unnecessary call to an empty 
 function

> In your example , you depend on the result of the call so you cannot remove the function 
> call because b is global (unless GCC can see all of your code).
> But here is an example where GCC does not remove the function at all (confirmed on the 
> mainline 20030806):
> int a;
> int get(int i)
> {
>   return i;
> }
> void foo()
> {
>   int b;
>   a=10;
>   b= get(a);
> }

Gcc will do these types of optimization with -finline-functions.  However, 
that can make code bigger (the inlining code really needs some work to 
make it more conservative with -Ospace).

R.



More information about the Gcc-bugs mailing list