From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28818 invoked by alias); 4 Sep 2005 16:26:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 28795 invoked by uid 48); 4 Sep 2005 16:25:56 -0000 Date: Sun, 04 Sep 2005 16:26:00 -0000 Message-ID: <20050904162556.28794.qmail@sourceware.org> From: "rguenth at gcc dot gnu dot org" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20050310154814.20408.chris@bubblescope.net> References: <20050310154814.20408.chris@bubblescope.net> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug middle-end/20408] Unnecessary code generated for empty structs X-Bugzilla-Reason: CC X-SW-Source: 2005-09/txt/msg00437.txt.bz2 List-Id: ------- Additional Comments From rguenth at gcc dot gnu dot org 2005-09-04 16:25 ------- For struct Foo {}; void foo(const Foo&); void bar(Foo); void fooc(void) { foo(Foo()); } void barc(void) { bar(Foo()); } we get different initializers for the Foo& and the Foo case: void fooc() () { struct Foo D.1594; : D.1594 = {}; foo (&D.1594); return; } void barc() () { struct Foo D.1613; : D.1613 = 0; bar (D.1613) [tail call]; return; } The former looks correct and does not produce initialization code for the temporary. The latter produces an unneccessary (uninitialized) initialization of the pass-by-value stack slot on x86. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20408