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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-08-15 
13:04:15 UTC ---
Some further observations:

a) Inlining: It fails according to -fdump-ipa-inline because of:
   not inlinable: say_hello/1 -> hello_integer/0,
                  --param large-stack-frame-growth limit reached
   Still, given that there is only one user of the function, one should expect
   that the function gets inlined.


For the following [(c) and (d)], I have the impression that the warning is
generated at the wrong spot.

b) I failed to generate a C version of the failing test case of comment 0.

c) For the program in comment 0, one enters rtx_for_function_call and one
properly calls those lines:

1678          if (!TREE_USED (fndecl) && fndecl != current_function_decl)
1679            TREE_USED (fndecl) = 1;

for <function_decl 0x2aaaac2a0300 hello_integer

However, that function is called *AFTER* check_global_declaration_1 and comes
thus too late.


d) There is no warning for internal procedures even though there should be:

     program test
     contains
       subroutine unused ()
       end subroutine unused
     end program test

   nor for the C version (compile with -std=gnu99 as nested functions is an
   extension):

     #include <stdio.h>

     int main ()
     {
       void foo() { };
       printf("Hello World!\n");
       return 0;
     }

  Given that "foo" and "unused" aren't global declarations, that's probably not
  surprising.

Reply via email to