From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19235 invoked by alias); 4 May 2006 15:25:51 -0000 Received: (qmail 18472 invoked by uid 48); 4 May 2006 15:25:37 -0000 Date: Thu, 04 May 2006 15:25:00 -0000 Message-ID: <20060504152537.18470.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/27370] [4.0 Regression] Bogus warning about ignoring function return value (__attribute__ ((warn_unused_result))) In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rguenth at gcc dot gnu dot org" 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 X-SW-Source: 2006-05/txt/msg00383.txt.bz2 List-Id: ------- Comment #5 from rguenth at gcc dot gnu dot org 2006-05-04 15:25 ------- The problem with 4.0 is that the CALL_EXPR uses the return slot address to return, but we don't honour that. Index: c-common.c =================================================================== *** c-common.c (revision 113528) --- c-common.c (working copy) *************** c_warn_unused_result (tree *top_p) *** 5658,5664 **** break; case CALL_EXPR: ! if (TREE_USED (t)) break; /* This is a naked call, as opposed to a CALL_EXPR nested inside --- 5658,5665 ---- break; case CALL_EXPR: ! if (TREE_USED (t) ! || CALL_EXPR_HAS_RETURN_SLOT_ADDR (t)) break; /* This is a naked call, as opposed to a CALL_EXPR nested inside though this makes PR27371 also fail for 4.0, as 4.0 shares the same problem of always emitting the "useless store". -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27370