public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
[parent not found: <bug-23372-7904@http.gcc.gnu.org/bugzilla/>]
* [Bug c++/23372] New: Temporary aggregate copy not elided when passing parameters by value
@ 2005-08-13  8:03 guillaume dot melquiond at ens-lyon dot fr
  2005-08-13 17:57 ` [Bug c++/23372] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
                   ` (12 more replies)
  0 siblings, 13 replies; 30+ messages in thread
From: guillaume dot melquiond at ens-lyon dot fr @ 2005-08-13  8:03 UTC (permalink / raw)
  To: gcc-bugs

This bug is similar to bug 16405, but although 16405 was fixed in 4.0, this one
is still present and is a regression from GCC 3.4 (not from 3.3 as was the
previous one). So I prefer opening a new bug-report.

The testcase simply calls a function f by passing the parameter by value:

struct A {
  int a[1000];
  //A(A const &);
};
void f(A);
void g(A *a) { f(*a); }

When compiled with gcc 3.3 and 3.4, the generated code for g is optimal: the
value *a is directly copied in the stack frame that will be used by f. With gcc
4.0, there is first a temporary copy in the stack frame of g, before copying the
value in the stack frame of f (two memcpys instead of one).

When putting a dummy copy constructor, both memcpys disappear: the code is
optimal. So the problem seems to be with the default trivial copy constructor.

The testcase is compiled with "g++-4.0 -O3", Debian package:

Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib --enable-nls
--without-included-gettext --enable-threads=posix --program-suffix=-4.0
--enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu
--enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk
--enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre
--enable-mpfr --disable-werror --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.0.2 20050806 (prerelease) (Debian 4.0.1-4)

-- 
           Summary: Temporary aggregate copy not elided when passing
                    parameters by value
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: guillaume dot melquiond at ens-lyon dot fr
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i486-linux-gnu


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


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

end of thread, other threads:[~2011-03-18 15:07 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-23372-4@http.gcc.gnu.org/bugzilla/>
2011-03-18 15:07 ` [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value jason at gcc dot gnu.org
     [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
2005-10-16 22:20 ` pinskia at gcc dot gnu dot org
2005-10-31  5:00 ` mmitchel at gcc dot gnu dot org
2006-01-31 15:24 ` pinskia at gcc dot gnu dot org
2006-01-31 16:03 ` rguenth at gcc dot gnu dot org
2006-01-31 16:05 ` pinskia at gcc dot gnu dot org
2006-01-31 16:05 ` pinskia at gcc dot gnu dot org
2006-02-02  9:16 ` rguenth at gcc dot gnu dot org
2006-02-02 17:16 ` sje at cup dot hp dot com
2006-02-03  1:49 ` hp at gcc dot gnu dot org
2006-02-03  9:16 ` rguenth at gcc dot gnu dot org
2006-02-07 15:36 ` rguenth at gcc dot gnu dot org
2006-08-23 14:23 ` jason at gcc dot gnu dot org
2006-08-23 14:23 ` jason at gcc dot gnu dot org
2006-08-23 14:34 ` jason at gcc dot gnu dot org
2006-10-07  3:49 ` pinskia at gcc dot gnu dot org
2006-10-07  6:16 ` pinskia at gcc dot gnu dot org
2005-08-13  8:03 [Bug c++/23372] New: " guillaume dot melquiond at ens-lyon dot fr
2005-08-13 17:57 ` [Bug c++/23372] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
2005-08-13 18:00 ` giovannibajo at libero dot it
2005-08-13 18:11 ` rguenth at tat dot physik dot uni-tuebingen dot de
2005-08-13 18:13 ` pinskia at gcc dot gnu dot org
2005-08-13 18:16 ` rguenth at tat dot physik dot uni-tuebingen dot de
2005-08-13 21:21 ` rguenth at gcc dot gnu dot org
2005-08-14  6:45 ` guillaume dot melquiond at ens-lyon dot fr
2005-08-26 14:59 ` rguenth at gcc dot gnu dot org
2005-08-26 17:40 ` guillaume dot melquiond at ens-lyon dot fr
2005-08-29 12:33 ` rguenth at gcc dot gnu dot org
2005-08-29 13:15 ` rguenth at gcc dot gnu dot org
2005-09-14  6:36 ` pinskia at gcc dot gnu dot org
2005-09-27 16:21 ` mmitchel at gcc dot gnu dot 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).