[Pkg-mono-svn-commits] [mono] 01/01: libgc: use __builtin_frame_address in GC_approx_sp
Mirco Bauer
meebey at moszumanska.debian.org
Sat Jun 11 15:22:18 UTC 2016
This is an automated email from the git hooks/post-receive script.
meebey pushed a commit to branch master-patches/fix_boehm_with_gcc5
in repository mono.
commit 13d81c5b0291a6140f4d2a763eada61805ca0edd
Author: James Laird-Wah <james.laird-wah at saludamedical.com>
Date: Mon Feb 8 10:19:53 2016 +1100
libgc: use __builtin_frame_address in GC_approx_sp
With GCC 5.x, the compiler optimises away the dummy load used to
estimate the stack pointer address in GC_approx_sp; it returns
zero. This leads to segfaults when embedding Mono.
Instead, use __builtin_frame_address, which GCC's libgc uses for
the same purpose.
---
libgc/mark_rts.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/libgc/mark_rts.c b/libgc/mark_rts.c
index b3e996a..561333a 100644
--- a/libgc/mark_rts.c
+++ b/libgc/mark_rts.c
@@ -368,6 +368,9 @@ ptr_t p;
ptr_t GC_approx_sp()
{
+#if defined(__GNUC__)
+ return __builtin_frame_address(0);
+#else
VOLATILE word dummy;
dummy = 42; /* Force stack to grow if necessary. Otherwise the */
@@ -376,17 +379,11 @@ ptr_t GC_approx_sp()
# ifdef _MSC_VER
# pragma warning(disable:4172)
# endif
-# if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 408)
-# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored "-Wreturn-local-addr"
-# endif
return((ptr_t)(&dummy));
-# if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 408)
-# pragma GCC diagnostic pop
-# endif
# ifdef _MSC_VER
# pragma warning(default:4172)
# endif
+#endif // __GNUC__
}
/*
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mono/packages/mono.git
More information about the Pkg-mono-svn-commits
mailing list