public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/20408] New: Unnessasary code generated for empty structs
@ 2005-03-10 15:48 chris at bubblescope dot net
  2005-03-10 15:57 ` [Bug c++/20408] " pinskia at gcc dot gnu dot org
                   ` (18 more replies)
  0 siblings, 19 replies; 25+ messages in thread
From: chris at bubblescope dot net @ 2005-03-10 15:48 UTC (permalink / raw)
  To: gcc-bugs

Given an empty struct (ie struct X { };), even at high optimisation levels g++
will insist on always allocating and zeroing some memory for empty structs.

This actually effects C++ code, including libstdc++-v3, as empty structs are
often used as a means of passing around functions.

EXAMPLE
------------------
struct X {};

void foo(X);

void call_foo()
{ foo(X()); }
------------------

generates (from -O3, t70.final_cleanup is:)
-------------------------------------------------
;; Function void call_foo() (_Z8call_foov)

void call_foo() ()
{
  struct X D.1597;

<bb 0>:
  D.1597 = 0;
  foo (D.1597) [tail call];
  return;

}
---------------------------------------------

-- 
           Summary: Unnessasary code generated for empty structs
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: chris at bubblescope dot net
                CC: gcc-bugs at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 25+ messages in thread
[parent not found: <bug-20408-9525@http.gcc.gnu.org/bugzilla/>]
[parent not found: <bug-20408-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2021-02-12  2:30 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-10 15:48 [Bug middle-end/20408] New: Unnessasary code generated for empty structs chris at bubblescope dot net
2005-03-10 15:57 ` [Bug c++/20408] " pinskia at gcc dot gnu dot org
2005-03-10 15:59 ` [Bug c++/20408] Unnecessary " chris at bubblescope dot net
2005-03-10 16:01 ` chris at bubblescope dot net
2005-03-10 16:06 ` chris at bubblescope dot net
2005-03-10 16:10 ` pinskia at gcc dot gnu dot org
2005-03-10 16:19 ` pcarlini at suse dot de
2005-03-10 16:21 ` pinskia at gcc dot gnu dot org
2005-03-10 17:06 ` pinskia at gcc dot gnu dot org
2005-03-10 17:07 ` pinskia at gcc dot gnu dot org
2005-03-10 17:14 ` pcarlini at suse dot de
2005-03-10 17:15 ` pinskia at gcc dot gnu dot org
2005-03-10 17:31 ` [Bug middle-end/20408] " pinskia at gcc dot gnu dot org
2005-03-10 17:35 ` pinskia at gcc dot gnu dot org
2005-09-04 16:26 ` rguenth at gcc dot gnu dot org
2005-09-04 16:37 ` rguenth at gcc dot gnu dot org
2005-09-04 17:12 ` rguenth at gcc dot gnu dot org
2005-09-05 10:36 ` rguenth at gcc dot gnu dot org
2005-09-05 10:48 ` rguenth at gcc dot gnu dot org
2005-09-05 12:38 ` rguenth at gcc dot gnu dot org
     [not found] <bug-20408-9525@http.gcc.gnu.org/bugzilla/>
2007-11-26 14:17 ` steven at gcc dot gnu dot org
2007-11-27  9:40 ` rguenth at gcc dot gnu dot org
     [not found] <bug-20408-4@http.gcc.gnu.org/bugzilla/>
2020-12-09 13:53 ` jason at gcc dot gnu.org
2021-02-09  1:52 ` cvs-commit at gcc dot gnu.org
2021-02-12  2:30 ` cvs-commit 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).