Project

General

Profile

Actions

Bug #12768

closed

Since r56158, compile error in "hash.c", line 1753, with old fcc on Solaris 10

Added by ngoto (Naohisa Goto) over 7 years ago. Updated over 7 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-dev:49808]

Description

おそらく 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;
 }
Actions #1

Updated by ngoto (Naohisa Goto) over 7 years ago

  • Status changed from Open to Closed

Applied in changeset r56171.


  • hash.c (each_pair_i_fast): Fix compile error with old version of
    fcc on Solaris 10. [Bug #12768] [ruby-dev:49808]
Actions

Also available in: Atom PDF

Like0
Like0