From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22279 invoked by alias); 30 Nov 2009 04:28:43 -0000 Received: (qmail 22263 invoked by uid 22791); 30 Nov 2009 04:28:41 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from e23smtp02.au.ibm.com (HELO e23smtp02.au.ibm.com) (202.81.31.144) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 30 Nov 2009 04:28:37 +0000 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [202.81.31.246]) by e23smtp02.au.ibm.com (8.14.3/8.13.1) with ESMTP id nAU4PsG1001966; Mon, 30 Nov 2009 15:25:54 +1100 Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id nAU4P0LI1667288; Mon, 30 Nov 2009 15:25:00 +1100 Received: from d23av01.au.ibm.com (loopback [127.0.0.1]) by d23av01.au.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id nAU4SX3K008912; Mon, 30 Nov 2009 15:28:33 +1100 Received: from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.190.163.12]) by d23av01.au.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id nAU4SWO3008902; Mon, 30 Nov 2009 15:28:32 +1100 Received: from [10.61.2.144] (haven.au.ibm.com [9.190.164.82]) (using SSLv3 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.au.ibm.com (Postfix) with ESMTP id 8FC137371F; Mon, 30 Nov 2009 15:28:27 +1100 (EST) Subject: PATCH, boehm-gc: silence warning From: Ben Elliston To: java , gcc-patches Cc: aph@redhat.com Content-Type: text/plain; charset="UTF-8" Date: Mon, 30 Nov 2009 04:28:00 -0000 Message-ID: <1259555306.23081.4.camel@bapbop> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Mailing-List: contact java-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-owner@gcc.gnu.org X-SW-Source: 2009-11/txt/msg00076.txt.bz2 When compiling mark_rts.c, GCC warns about taking the address of a local variable. This is not a bug, but an explicit hack to get the approximate address of a new stack frame, to calculate the limits of the current frame. There is a cleaner way to do this with GCC: use __builtin_frame_address. My reading of the code suggests that this will work just as well. Tested with a bootstrap on x86_64-linux and a full regression testsuite run, including make check-target-boehm-gc. Okay for mainline? 2009-11-30 Ben Elliston * mark_rts.c (GC_approx_sp): Use __builtin_frame_address when compiling with GCC rather than taking the address of a local variable. Index: mark_rts.c =================================================================== --- mark_rts.c (revision 154749) +++ mark_rts.c (working copy) @@ -376,7 +376,13 @@ ptr_t GC_approx_sp() # ifdef _MSC_VER # pragma warning(disable:4172) # endif - return((ptr_t)(&dummy)); +#ifdef __GNUC__ + /* Eliminate a warning from GCC about taking the address of a + local variable. */ + return __builtin_frame_address (0); +#else + return ((ptr_t)(&dummy)); +#endif /* __GNUC__ */ # ifdef _MSC_VER # pragma warning(default:4172) # endif