public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56606] New: GCC refuses to emit long calls for operator new/delete on PowerPC
@ 2013-03-12 20:26 gcc at mrozekma dot com
  2013-03-14 20:20 ` [Bug c++/56606] " gcc at mrozekma dot com
  0 siblings, 1 reply; 2+ messages in thread
From: gcc at mrozekma dot com @ 2013-03-12 20:26 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56606
           Summary: GCC refuses to emit long calls for operator new/delete
                    on PowerPC
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: gcc@mrozekma.com


-mlongcall seems to have no effect on operator new and operator delete. For
example, given the code:

> extern void foo();
> void bar() {
>     foo();
>     new char;
> }

A normal run of GCC on PowerPC will generate the (abridged) assembly:

> bl _Z3foov
> bl _Znwj

Running GCC with the -mlongcall option generates:

> lis r9, _Z3foov@ha
> addi r9, r9, _Z3foov@l
> mtctr r9
> bctrl
> bl _Znwj

The branch to foo() was expanded as expected, but the branch to operator new is
still short. Calls to random libc and libstdc++ functions are all converted; so
far operator new and operator delete are the only ones I've seen that don't
work. This seems similar to bug 12769, but that was for generated functions

---

GCC build info:

> Target: ppc-redhat-linux
> Configured with: ./configure --prefix=/opt/gcc-4.7.2-ppc --mandir=/opt/gcc-4.7.2-ppc/share/man --enable-shared --enable-threads=posix --with-system-zlib --enable-languages=c,c++ --build=ppc-redhat-linux --host=ppc-redhat-linux --target=ppc-redhat-linux
> gcc version 4.7.2 (GCC) 

Test compiled with:

> g++ -mlongcall -c -o test.o test.cpp


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

* [Bug c++/56606] GCC refuses to emit long calls for operator new/delete on PowerPC
  2013-03-12 20:26 [Bug c++/56606] New: GCC refuses to emit long calls for operator new/delete on PowerPC gcc at mrozekma dot com
@ 2013-03-14 20:20 ` gcc at mrozekma dot com
  0 siblings, 0 replies; 2+ messages in thread
From: gcc at mrozekma dot com @ 2013-03-14 20:20 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #1 from Michael Mrozek <gcc at mrozekma dot com> 2013-03-14 20:20:22 UTC ---
I found that including any of the standard C++ headers (<string>, <list>,
<map>, etc.) works around this, as does forward-declaring the operator:

> void* operator new(std::size_t);


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

end of thread, other threads:[~2013-03-14 20:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-12 20:26 [Bug c++/56606] New: GCC refuses to emit long calls for operator new/delete on PowerPC gcc at mrozekma dot com
2013-03-14 20:20 ` [Bug c++/56606] " gcc at mrozekma dot com

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).