From: matz@... (Yukihiro Matsumoto) Date: 1997-12-18T13:29:35+09:00 Subject: [ruby-dev:1133] Re: [BUG] mershal まつもと ゆきひろです In message "[ruby-dev:1123] [BUG] mershal" on 97/12/17, Keiju ISHITSUKA writes: |けいじゅ@日本ラショナルソフトウェアです. | |marshal回りでバグがあるようです. まずパッチを出します.でも,これは本質的にはgccの最適化の問 題のようです.パッチを当てた後,-O2オプションを外すと正常に 動作します(いや,正常がなんだか知らないんだけど,正常そうに 見える動作をします).どうしたもんだか…. # volatileをつけてもダメだった. --- marshal.c~ Thu Dec 11 13:15:32 1997 +++ marshal.c Thu Dec 18 13:38:23 1997 @@ -714,3 +714,3 @@ int i, len; - int num = arg->data->num_entries; + ID slot; @@ -730,5 +730,10 @@ for (i=0; iptr[i] != INT2FIX(slot)) - TypeError("struct not compatible"); + slot = r_symbol(arg); + + if (RARRAY(mem)->ptr[i] != INT2FIX(slot)) { + TypeError("struct %s not compatible (:%s for :%s)", + rb_class2name(class), + rb_id2name(slot), + rb_id2name(FIX2INT(RARRAY(mem)->ptr[i]))); + } struct_aset(v, INT2FIX(i), r_object(arg)); @@ -857,3 +862,3 @@ rb_define_module_function(mMarshal, "dump", marshal_dump, -1); - rb_define_module_function(mMarshal, "load", marshal_load, 1); + rb_define_module_function(mMarshal, "load", marshal_load, -1); rb_define_module_function(mMarshal, "restore", marshal_load, 1);