From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2454 invoked by alias); 14 Sep 2012 14:55:22 -0000 Received: (qmail 2444 invoked by uid 22791); 14 Sep 2012 14:55:20 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 14 Sep 2012 14:55:08 +0000 From: "ebotcazou at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/54315] Unnecessary copy of return value Date: Fri, 14 Sep 2012 14:55:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ebotcazou at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Status Last reconfirmed CC Ever Confirmed Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-09/txt/msg01113.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54315 Eric Botcazou changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2012-09-14 CC| |ebotcazou at gcc dot | |gnu.org Ever Confirmed|0 |1 --- Comment #3 from Eric Botcazou 2012-09-14 14:54:53 UTC --- The big discrepancy between structures and unions comes from: /* Compute the TYPE_MODE for the TYPE (which is a RECORD_TYPE). */ void compute_record_mode (tree type) { [...] /* If we only have one real field; use its mode if that mode's size matches the type's size. This only applies to RECORD_TYPE. This does not apply to unions. */ if (TREE_CODE (type) == RECORD_TYPE && mode != VOIDmode && host_integerp (TYPE_SIZE (type), 1) && GET_MODE_BITSIZE (mode) == TREE_INT_CST_LOW (TYPE_SIZE (type))) SET_TYPE_MODE (type, mode); else SET_TYPE_MODE (type, mode_for_size_tree (TYPE_SIZE (type), MODE_INT, 1)); so the structure is given XFmode but the union is given BKLmode. Apparently someone has attempted to bridge the gap but this was reverted by: ------------------------------------------------------------------------ r37041 | wilson | 2000-10-25 03:30:25 +0200 (Wed, 25 Oct 2000) | 6 lines Fixes for C++ structure layout breakage. * expmed.c (store_bit_field): Move integer pun code down after code that calls emit_move_insn for entire register move. * stor-layout.c (compute_record_mode): Revert Mar 25, Aug 18, and Oct 20 changes. Only store mode in TYPE_MODE if RECORD_TYPE.