summarylogtreecommitdiffstats
path: root/gcc7.patch
blob: caa44ae4f106e20008a5e97e09876d8b6d4b65a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index 6e430da179..bcc407045b 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -512,7 +512,10 @@ static inline int rb_type(VALUE obj);
  * itself.  don't use it directly */
 #ifdef __GNUC__
 #define RB_GC_GUARD_PTR(ptr) \
-    __extension__ ({volatile VALUE *rb_gc_guarded_ptr = (ptr); rb_gc_guarded_ptr;})
+    __extension__ ({volatile VALUE *rb_gc_guarded_ptr = (ptr); \
+	__asm__("" : : "m"(rb_gc_guarded_ptr)); \
+	rb_gc_guarded_ptr; \
+    })
 #else
 #ifdef _MSC_VER
 #pragma optimize("", off)
diff --git a/marshal.c b/marshal.c
index d322e3a5ba..a21d5f8ef2 100644
--- a/marshal.c
+++ b/marshal.c
@@ -1014,7 +1014,7 @@ marshal_dump(int argc, VALUE *argv)
 	else if (NIL_P(a1)) io_needed();
 	else port = a1;
     }
-    wrapper = TypedData_Make_Struct(rb_cData, struct dump_arg, &dump_arg_data, arg);
+    wrapper = TypedData_Make_Struct(0, struct dump_arg, &dump_arg_data, arg);
     arg->dest = 0;
     arg->symbols = st_init_numtable();
     arg->data    = rb_init_identtable();
@@ -2038,7 +2038,7 @@ marshal_load(int argc, VALUE *argv)
     else {
 	io_needed();
     }
-    wrapper = TypedData_Make_Struct(rb_cData, struct load_arg, &load_arg_data, arg);
+    wrapper = TypedData_Make_Struct(0, struct load_arg, &load_arg_data, arg);
     arg->infection = infection;
     arg->src = port;
     arg->offset = 0;
diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb
index 1dc9850d25..e89dd31d22 100644
--- a/test/ruby/test_marshal.rb
+++ b/test/ruby/test_marshal.rb
@@ -644,6 +644,9 @@ class TestMarshal < Test::Unit::TestCase
     c = Bug9523.new
     assert_raise_with_message(RuntimeError, /Marshal\.dump reentered at marshal_dump/) do
       Marshal.dump(c)
+      GC.start
+      1000.times {"x"*1000}
+      GC.start
       c.cc.call
     end
   end