From: naruse@... Date: 2018-12-10T23:47:57+00:00 Subject: [ruby-dev:50696] [Ruby trunk Bug#15292][Third Party's Issue] Since r64852, on Solaris with Oracle Developer Studio 12.6, compile error of iseq.c Issue #15292 has been updated by naruse (Yui NARUSE). Status changed from Open to Third Party's Issue さすがにこれはOracle Developer Studio 12.6のバグっぽいので、まだBetaなようですしコンパイラ側に報告してもらえませんか。 ---------------------------------------- Bug #15292: Since r64852, on Solaris with Oracle Developer Studio 12.6, compile error of iseq.c https://bugs.ruby-lang.org/issues/15292#change-75561 * Author: ngoto (Naohisa Goto) * Status: Third Party's Issue * Priority: Normal * Assignee: ngoto (Naohisa Goto) * Target version: * ruby -v: * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN ---------------------------------------- r64852以降、Solaris 10 上の Oracle Developer Studio 12.6 にてコンパイルすると、以下のエラーでiseq.c のコンパイルに失敗します。(r65641 にて確認) ~~~ cc -errtags=yes -xO4 -xtarget=sparc64xplus -m64 -DRUBY_DEVEL=1 -DRUBY_EXPORT -DCANONICALIZATION_FOR_MATHN -I/usr/local/64/lib/libffi-3.0.10/include -I/usr/local/64/include -D_XOPEN_SOURCE=600 -I. -I.ext/include/sparc64-solaris2.10 -I./include -I. -I./enc/unicode/10.0.0 -o iseq.o -c iseq.c "iseq.c", line 579: identifier redefined: flag current : unsigned long previous: unsigned long : "iseq.c", line 578 "iseq.c", line 580: identifier redefined: flag current : unsigned long previous: unsigned long : "iseq.c", line 579 "iseq.c", line 581: identifier redefined: flag current : unsigned long previous: unsigned long : "iseq.c", line 580 "iseq.c", line 582: identifier redefined: flag current : unsigned long previous: unsigned long : "iseq.c", line 581 "iseq.c", line 583: identifier redefined: flag current : unsigned long previous: unsigned long : "iseq.c", line 582 "iseq.c", line 584: identifier redefined: flag current : unsigned long previous: unsigned long : "iseq.c", line 583 "iseq.c", line 585: identifier redefined: flag current : unsigned long previous: unsigned long : "iseq.c", line 584 "iseq.c", line 586: identifier redefined: flag current : unsigned long previous: unsigned long : "iseq.c", line 585 "iseq.c", line 587: identifier redefined: flag current : unsigned long previous: unsigned long : "iseq.c", line 586 "iseq.c", line 705: warning: operands have incompatible types: const struct rb_compile_option_struct {unsigned int inline_const_cache :1, unsigned int peephole_optimization :1, unsigned int tailcall_optimization :1, unsigned int specialized_instruction :1, unsigned int operands_unification :1, unsigned int instructions_unification :1, unsigned int stack_caching :1, unsigned int frozen_string_literal :1, unsigned int debug_frozen_string_literal :1, unsigned int coverage_enabled :1, int debug_level} ":" struct rb_compile_option_struct {unsigned int inline_const_cache :1, unsigned int peephole_optimization :1, unsigned int tailcall_optimization :1, unsigned int specialized_instruction :1, unsigned int operands_unification :1, unsigned int instructions_unification :1, unsigned int stack_caching :1, unsigned int frozen_string_literal :1, unsigned int debug_frozen_string_literal :1, unsigned int coverage_enabled :1, int debug_level} (E_OPERANDS_INCOMPATIBLE_TYPES) "iseq.c", line 1976: warning: statement not reached (E_STATEMENT_NOT_REACHED) "iseq.c", line 2389: warning: statement not reached (E_STATEMENT_NOT_REACHED) cc: acomp failed for iseq.c make: *** [iseq.o] Error 2 ~~~ flag という変数が再定義された、というエラーが出ていますが、理由はよくわかりません。 当該コンパイラ Oracle Developer Studio 12.6 のバグかもしれないと疑っています。 なお、前バージョン Oracle Developer Studio 12.5 では発生せず正常にコンパイル終了します。 (Oracle Solaris Studio 12.4 以前ではさらに別のエラーが発生しますが、別チケットにて報告します。) 以下のように、Cのマクロの定石の一つである do-while(0) でブロックを囲むコードに変更すると、エラー無くコンパイルできるようになりました。 ~~~ --- iseq.c (revision 65645) +++ iseq.c (working copy) @@ -567,14 +567,14 @@ set_compile_option_from_hash(rb_compile_option_t *option, VALUE opt) { #define SET_COMPILE_OPTION(o, h, mem) \ - { VALUE flag = rb_hash_aref((h), ID2SYM(rb_intern(#mem))); \ + do { VALUE flag = rb_hash_aref((h), ID2SYM(rb_intern(#mem))); \ if (flag == Qtrue) { (o)->mem = 1; } \ else if (flag == Qfalse) { (o)->mem = 0; } \ - } + } while (0) #define SET_COMPILE_OPTION_NUM(o, h, mem) \ - { VALUE num = rb_hash_aref(opt, ID2SYM(rb_intern(#mem))); \ + do { VALUE num = rb_hash_aref(opt, ID2SYM(rb_intern(#mem))); \ if (!NIL_P(num)) (o)->mem = NUM2INT(num); \ - } + } while (0) SET_COMPILE_OPTION(option, opt, inline_const_cache); SET_COMPILE_OPTION(option, opt, peephole_optimization); SET_COMPILE_OPTION(option, opt, tailcall_optimization); ~~~ -- https://bugs.ruby-lang.org/