public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/61909] New: Small function optimization not applied to small objects
@ 2014-07-25 10:47 lukeocamden at gmail dot com
  2014-07-28  8:51 ` [Bug libstdc++/61909] " redi at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: lukeocamden at gmail dot com @ 2014-07-25 10:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 61909
           Summary: Small function optimization not applied to small
                    objects
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lukeocamden at gmail dot com

Seems like std::function only manages to avoid malloc for function pointers,
but not for small objects.

$ g++ --version
g++ (GCC) 4.10.0 20140720 (experimental)

Here's a test I ran on my Linux machine:

#include <functional>

extern "C" void* malloc(size_t) { abort(); }

struct X
{
  void operator()() { }
};

void foo() { }

int main()
{
  std::function<void()> f1((static_cast<void (*)()>([]{}))); // OK
  std::function<void()> f2(foo); // OK
  std::function<void()> f3((X())); // abort
  std::function<void()> f4([]{}); // abort
}


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

end of thread, other threads:[~2014-10-10 22:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-25 10:47 [Bug libstdc++/61909] New: Small function optimization not applied to small objects lukeocamden at gmail dot com
2014-07-28  8:51 ` [Bug libstdc++/61909] " redi at gcc dot gnu.org
2014-08-01 15:27 ` lukeocamden at gmail dot com
2014-08-01 16:34 ` redi at gcc dot gnu.org
2014-08-04 11:13 ` lukeocamden at gmail dot com
2014-08-04 11:15 ` redi at gcc dot gnu.org
2014-09-12 18:58 ` redi at gcc dot gnu.org
2014-10-09 18:18 ` redi at gcc dot gnu.org
2014-10-09 18:35 ` redi at gcc dot gnu.org
2014-10-10 22:20 ` redi 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).