From: Ben Elliston <bje@au1.ibm.com>
To: java <java@gcc.gnu.org>, gcc-patches <gcc-patches@gcc.gnu.org>
Cc: aph@redhat.com
Subject: PATCH, boehm-gc: silence warning
Date: Mon, 30 Nov 2009 04:28:00 -0000 [thread overview]
Message-ID: <1259555306.23081.4.camel@bapbop> (raw)
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 <bje@au.ibm.com>
* 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
next reply other threads:[~2009-11-30 4:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-30 4:28 Ben Elliston [this message]
2009-11-30 10:07 ` Andrew Haley
2012-01-10 23:40 ` Gnu Classpath on HP webOS : connexion problem between escher and X server / or loadling escher problem by Gnu classpath Yannick
2012-01-10 23:53 ` Brian Jones
2012-01-11 9:05 ` Mark Wielaard
2012-01-16 20:44 ` Yannick
2012-01-16 20:45 ` Yannick
2012-01-17 19:13 ` Yannick
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1259555306.23081.4.camel@bapbop \
--to=bje@au1.ibm.com \
--cc=aph@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=java@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).