From: ngotogenome@... Date: 2015-06-03T15:20:02+00:00 Subject: [ruby-dev:49020] [Ruby trunk - Bug #11217] [Open] vm_method.c compile error by fcc on Solaris 10 Issue #11217 has been reported by Naohisa Goto. ---------------------------------------- Bug #11217: vm_method.c compile error by fcc on Solaris 10 https://bugs.ruby-lang.org/issues/11217 * Author: Naohisa Goto * Status: Open * Priority: Normal * Assignee: Koichi Sasada * ruby -v: ruby 2.3.0dev (2015-06-03) [sparc64-solaris2.10] * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- Solaris 10 上の古いfccにて、r50728以降、vm_method.c (vm.c から読み込まれる)のコンパイルに失敗します。 下記はr50750でのエラーメッセージです。 ~~~ fcc -O2 -KV9 -KVIS2 -DRUBY_EXPORT -I/usr/local/64/lib/libffi-3.0.10/include -I/usr/local/64/include -I. -I.ext/include/sparc64-solaris2.10 -I./include -I. -o vm.o -c vm.c (中略) "./vm_method.c", line 567: error: initialization: constant expression is expected for variable: `iseq_body' (中略) make: *** [vm.o] Error 1 ~~~ 該当行付近は以下のような感じです。「この行でエラー」の部分でエラーになります。 ~~~ void rb_add_method_iseq(VALUE klass, ID mid, VALUE iseqval, rb_cref_t *cref, rb_method_visibility_t visi) { rb_iseq_t *iseq; GetISeqPtr(iseqval, iseq); { rb_method_iseq_t iseq_body = {iseq, cref}; /* ←この行でエラーになる */ rb_add_method(klass, mid, VM_METHOD_TYPE_ISEQ, &iseq_body, visi); } } ~~~ このコンパイラは、構造体の初期化を変数で行うのには対応していないようです。 バージョンは以下のとおりです。 (古過ぎる?しかし売り物なので、そう簡単にバージョンアップできない。) ~~~ % fcc -v fcc: Fujitsu C Compiler Driver Version 5.6 (Nov 24 2006 14:03:59) usage: fcc [options] files ~~~ 通常、ひとつずつ代入するように修正すれば問題ないのですが、この構造体のメンバは以下のように全部constになっているため、一筋縄ではいかなさそうでした。 ~~~ typedef struct rb_method_iseq_struct { rb_iseq_t * const iseqptr; /* should be separated from iseqval */ rb_cref_t * const cref; /* shoudl be marked */ } rb_method_iseq_t; ~~~ -- https://bugs.ruby-lang.org/