From 8cc9818463fc72c08118ae83cd6a1d8c91106d86 Mon Sep 17 00:00:00 2001 From: nagachika Date: Mon, 16 Jan 2017 19:29:32 +0000 Subject: merge revision(s) 57020,57021: [Backport #13014] Add clang volatile fixes from FreeBSD and NetBSD. Use volatile instead of optnone to avoid optimization which causes segmentation faults. Patch by Dimitry Andric. [ruby-core:78531] [Bug #13014] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@57347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- cont.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'cont.c') diff --git a/cont.c b/cont.c index 10b1cc602c..b2e48c6202 100644 --- a/cont.c +++ b/cont.c @@ -167,7 +167,7 @@ static VALUE rb_eFiberError; if (!(ptr)) rb_raise(rb_eFiberError, "uninitialized fiber"); \ } while (0) -NOINLINE(static VALUE cont_capture(volatile int *stat)); +NOINLINE(static VALUE cont_capture(volatile int *volatile stat)); #define THREAD_MUST_BE_RUNNING(th) do { \ if (!(th)->tag) rb_raise(rb_eThreadError, "not running thread"); \ @@ -475,13 +475,9 @@ cont_new(VALUE klass) } static VALUE -cont_capture(volatile int *stat) -#if defined(__clang__) && \ - __clang_major__ == 3 && __clang_minor__ == 8 && __clang_patch__ == 0 -__attribute__ ((optnone)) -#endif +cont_capture(volatile int *volatile stat) { - rb_context_t *cont; + rb_context_t *volatile cont; rb_thread_t *th = GET_THREAD(); volatile VALUE contval; -- cgit v1.2.3