public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/55546] New: Static functions that are fully inlined can end up in the object file
@ 2012-11-30 13:04 rohan at rohanlean dot de
  2012-12-03 11:49 ` [Bug middle-end/55546] " rguenth at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: rohan at rohanlean dot de @ 2012-11-30 13:04 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55546
           Summary: Static functions that are fully inlined can end up in
                    the object file
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: rohan@rohanlean.de


Created attachment 28838
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28838
A rather minimal test-case for the bug.

If a static function has its address taken in the C code, but due to
optimisations the address is never used, then the function can still end up in
the object file.  I have attached a file to demonstrate the bug.  When I
compile it with -std=c11 -O3, the resulting executable will contain code for f,
even though it is not needed.  (As an aside, if you add another function
similar to f, and call h with each of them, then gcc will not resolve things so
nicely at compile time and also emit code for h.)


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

end of thread, other threads:[~2012-12-03 11:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-30 13:04 [Bug c/55546] New: Static functions that are fully inlined can end up in the object file rohan at rohanlean dot de
2012-12-03 11:49 ` [Bug middle-end/55546] " rguenth 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).