aboutsummaryrefslogtreecommitdiffstats
path: root/vm_eval.c
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-07 23:27:51 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-07 23:27:51 +0000
commit8e385ad70b3571dbdce5ea48524b358d9630238a (patch)
treede3ac74b5f70b9251972088215a294d7e6fb3ba8 /vm_eval.c
parentc2ba4b0e5aefd059e72afe8e1d74c0b6b0f8ce0e (diff)
downloadruby-8e385ad70b3571dbdce5ea48524b358d9630238a.tar.gz
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/trunk@57020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_eval.c')
-rw-r--r--vm_eval.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/vm_eval.c b/vm_eval.c
index f0274e1b9a..c08a849e59 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -1280,7 +1280,7 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, rb_cref_t *const cref_
{
int state;
VALUE result = Qundef;
- rb_thread_t *th = GET_THREAD();
+ rb_thread_t *volatile th = GET_THREAD();
struct rb_block block;
const struct rb_block *base_block;
volatile VALUE file;
@@ -1997,7 +1997,7 @@ rb_catch(const char *tag, VALUE (*func)(), VALUE data)
return rb_catch_obj(vtag, func, data);
}
-static VALUE vm_catch_protect(VALUE, rb_block_call_func *, VALUE, int *, rb_thread_t *);
+static VALUE vm_catch_protect(VALUE, rb_block_call_func *, VALUE, int *, rb_thread_t *volatile);
VALUE
rb_catch_obj(VALUE t, VALUE (*func)(), VALUE data)
@@ -2018,11 +2018,11 @@ rb_catch_protect(VALUE t, rb_block_call_func *func, VALUE data, int *stateptr)
static VALUE
vm_catch_protect(VALUE tag, rb_block_call_func *func, VALUE data,
- int *stateptr, rb_thread_t *th)
+ int *stateptr, rb_thread_t *volatile th)
{
int state;
VALUE val = Qnil; /* OK */
- rb_control_frame_t *saved_cfp = th->cfp;
+ rb_control_frame_t *volatile saved_cfp = th->cfp;
TH_PUSH_TAG(th);