* PATCH, boehm-gc: silence warning
@ 2009-11-30 4:52 Ben Elliston
2009-11-30 10:07 ` Andrew Haley
0 siblings, 1 reply; 2+ messages in thread
From: Ben Elliston @ 2009-11-30 4:52 UTC (permalink / raw)
To: java, gcc-patches; +Cc: aph
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: PATCH, boehm-gc: silence warning
2009-11-30 4:52 PATCH, boehm-gc: silence warning Ben Elliston
@ 2009-11-30 10:07 ` Andrew Haley
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Haley @ 2009-11-30 10:07 UTC (permalink / raw)
To: Ben Elliston; +Cc: java, gcc-patches
Ben Elliston wrote:
> 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?
OK, but make sure this goes upstream to gc@linux.hpl.hp.com
Andrew.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-11-30 10:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-30 4:52 PATCH, boehm-gc: silence warning Ben Elliston
2009-11-30 10:07 ` Andrew Haley
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).