public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/68002] New: retaining unused static functions at -O1
@ 2015-10-17 12:27 Joost.VandeVondele at mat dot ethz.ch
  2015-10-17 15:19 ` [Bug middle-end/68002] " Joost.VandeVondele at mat dot ethz.ch
  2015-10-19 10:25 ` vondele at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: Joost.VandeVondele at mat dot ethz.ch @ 2015-10-17 12:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68002

            Bug ID: 68002
           Summary: retaining unused static functions at -O1
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Joost.VandeVondele at mat dot ethz.ch
  Target Milestone: ---

There are uses for retaining unused static functions even if optimising, e.g.
coverage testing. Right now these function are removed at -O1 and there is no
flag to keep them. 

In https://gcc.gnu.org/ml/gcc-help/2015-10/msg00110.html Marc Glisse suggested
to introduce a flag similar to -fkeep-inline-functions.

c testcase:
> cat test.c
static void foo() { }

> gcc -c -O0 test.c ; nm test.o
0000000000000000 t foo
> gcc -c -O1 test.c ; nm test.o

Fortran testcase:

> cat test.f90
MODULE foo
 PRIVATE
CONTAINS
 SUBROUTINE bar()
 END SUBROUTINE bar
END MODULE

I'll try to come up with a patch based on Marc's suggestion


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

* [Bug middle-end/68002] retaining unused static functions at -O1
  2015-10-17 12:27 [Bug middle-end/68002] New: retaining unused static functions at -O1 Joost.VandeVondele at mat dot ethz.ch
@ 2015-10-17 15:19 ` Joost.VandeVondele at mat dot ethz.ch
  2015-10-19 10:25 ` vondele at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: Joost.VandeVondele at mat dot ethz.ch @ 2015-10-17 15:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68002

Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |https://gcc.gnu.org/ml/gcc-
                   |                            |patches/2015-10/msg01667.ht
                   |                            |ml
                 CC|                            |Joost.VandeVondele at mat dot ethz
                   |                            |.ch

--- Comment #1 from Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> ---
patch posted at https://gcc.gnu.org/ml/gcc-patches/2015-10/msg01667.html


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

* [Bug middle-end/68002] retaining unused static functions at -O1
  2015-10-17 12:27 [Bug middle-end/68002] New: retaining unused static functions at -O1 Joost.VandeVondele at mat dot ethz.ch
  2015-10-17 15:19 ` [Bug middle-end/68002] " Joost.VandeVondele at mat dot ethz.ch
@ 2015-10-19 10:25 ` vondele at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: vondele at gcc dot gnu.org @ 2015-10-19 10:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68002

--- Comment #2 from vondele at gcc dot gnu.org ---
Author: vondele
Date: Mon Oct 19 10:24:37 2015
New Revision: 228965

URL: https://gcc.gnu.org/viewcvs?rev=228965&root=gcc&view=rev
Log:
Fix PR68002, add -fkeep-static-functions

gcc/ChangeLog:

2015-10-17  Joost VandeVondele  <vondele@gnu.gcc.org>

        PR middle-end/68002
        * common.opt (fkeep-static-functions): New option.
        * doc/invoke.texi: Document it.
        * cgraphunit.c (cgraph_node::finalize_function): Use it.

gcc/testsuite/ChangeLog:

2015-10-17  Joost VandeVondele  <vondele@gnu.gcc.org>

        PR middle-end/68002
        * gcc.dg/PR68002.c: New test.


Added:
    trunk/gcc/testsuite/gcc.dg/PR68002.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cgraphunit.c
    trunk/gcc/common.opt
    trunk/gcc/doc/invoke.texi
    trunk/gcc/testsuite/ChangeLog


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

end of thread, other threads:[~2015-10-19 10:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-17 12:27 [Bug middle-end/68002] New: retaining unused static functions at -O1 Joost.VandeVondele at mat dot ethz.ch
2015-10-17 15:19 ` [Bug middle-end/68002] " Joost.VandeVondele at mat dot ethz.ch
2015-10-19 10:25 ` vondele at gcc dot gnu.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).