public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/54224] Bogus -Wunused-function warning with static function
Date: Wed, 15 Aug 2012 13:04:00 -0000	[thread overview]
Message-ID: <bug-54224-4-axHDiCTBn7@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-54224-4@http.gcc.gnu.org/bugzilla/>

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.


  parent reply	other threads:[~2012-08-15 13:04 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-10 15:44 [Bug middle-end/54224] New: [4.8 Regression] " burnus at gcc dot gnu.org
2012-08-11  9:03 ` [Bug middle-end/54224] " burnus at gcc dot gnu.org
2012-08-15 12:39 ` burnus at gcc dot gnu.org
2012-08-15 13:04 ` burnus at gcc dot gnu.org [this message]
2012-08-15 18:30 ` [Bug middle-end/54224] [4.8 Regression] " janus at gcc dot gnu.org
2012-08-16  9:57 ` burnus at gcc dot gnu.org
2012-08-16 11:07 ` rguenth at gcc dot gnu.org
2012-08-21  8:49 ` burnus at gcc dot gnu.org
2012-09-15 17:42 ` [Bug fortran/54224] " janus at gcc dot gnu.org
2012-09-15 17:48 ` burnus at gcc dot gnu.org
2012-09-15 18:26 ` janus at gcc dot gnu.org
2012-09-19 14:25 ` rguenth at gcc dot gnu.org
2012-10-19 17:15 ` janus at gcc dot gnu.org
2012-10-19 17:23 ` janus at gcc dot gnu.org
2012-10-19 17:49 ` janus at gcc dot gnu.org
2012-10-19 17:54 ` [Bug fortran/54224] Warn for unused (private) module variables and internal procedures janus at gcc dot gnu.org
2012-10-20 21:18 ` janus at gcc dot gnu.org
2013-03-22 14:45 ` jakub at gcc dot gnu.org
2013-05-31 10:59 ` jakub at gcc dot gnu.org
2013-08-19 21:18 ` janus at gcc dot gnu.org
2013-08-19 21:22 ` [Bug fortran/54224] Warn for unused " janus at gcc dot gnu.org
2013-10-16  9:51 ` jakub at gcc dot gnu.org
2015-06-22 14:26 ` rguenth at gcc dot gnu.org
2015-09-13 13:45 ` dominiq at lps dot ens.fr
2015-09-13 15:04 ` manu at gcc dot gnu.org
2015-09-13 15:24 ` dominiq at lps dot ens.fr
2015-09-13 15:52 ` manu at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-54224-4-axHDiCTBn7@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).