From: ngotogenome@... Date: 2016-09-16T12:15:06+00:00 Subject: [ruby-dev:49808] [Ruby trunk Bug#12768] Since r56158, compile error in "hash.c", line 1753, with old fcc on Solaris 10 Issue #12768 has been reported by Naohisa Goto. ---------------------------------------- Bug #12768: Since r56158, compile error in "hash.c", line 1753, with old fcc on Solaris 10 https://bugs.ruby-lang.org/issues/12768 * Author: Naohisa Goto * Status: Open * Priority: Normal * Assignee: * ruby -v: * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- おそらく r56158 以降、Solaris 10上の古い Fujitsu C Compiler (fcc) にて、以下のコンパイルエラーが発生します。 ``` fcc -O2 -KV9 -KVIS2 -DRUBY_EXPORT -I/usr/local/64/lib/libffi-3.0.10/include -I/usr/local/64/include -D_XOPEN_SOURCE=500 -I. -I.ext/include/sparc64-solaris2.10 -I./include -I. -I./enc/unicode/9.0.0 -o hash.o -c hash.c (warningは省略) "hash.c", line 1753: error: initialization: constant expression is expected for variable: `argv' (warningは省略) make: *** [hash.o] Error 1 ``` 以下のように1個ずつ代入するようにしたら、コンパイルが通るようになりました。 今時のコンパイラなら、最適化が効くので、このように書いても速度やコードサイズは元と変わらないと思います、多分。 ``` =================================================================== --- hash.c (revision 56170) +++ hash.c (working copy) @@ -1750,7 +1750,9 @@ static int each_pair_i_fast(VALUE key, VALUE value) { - VALUE argv[2] = {key, value}; + VALUE argv[2]; + argv[0] = key; + argv[1] = value; rb_yield_values2(2, argv); return ST_CONTINUE; } ``` -- https://bugs.ruby-lang.org/