From: ngotogenome@... Date: 2018-11-10T11:28:43+00:00 Subject: [ruby-dev:50667] [Ruby trunk Bug#15292] Since r64852, on Solaris with Oracle Developer Studio 12.6, compile error of iseq.c Issue #15292 has been updated by ngoto (Naohisa Goto). iseq.c のコンパイルは通りましたが、謎のリンクエラーが発生していました。 コンパイラまたは周辺のバグかもしれませんが全く不明です。 ~~~ cc -errtags=yes -xO4 -xtarget=sparc64xplus -m64 -L. -L/usr/local/64/lib -R/usr/local/64/lib main.o dmydln.o miniinit.o dmyext.o miniprelude.o array.o ast.o bignum.o class.o compar.o compile.o complex.o cont.o debug.o debug_counter.o dir.o dln_find.o encoding.o enum.o enumerator.o error.o eval.o file.o gc.o hash.o inits.o io.o iseq.o load.o marshal.o math.o mjit.o mjit_compile.o node.o numeric.o object.o pack.o parse.o proc.o process.o random.o range.o rational.o re.o regcomp.o regenc.o regerror.o regexec.o regparse.o regsyntax.o ruby.o safe.o signal.o sprintf.o st.o strftime.o string.o struct.o symbol.o thread.o time.o transcode.o transient_heap.o util.o variable.o version.o vm.o vm_backtrace.o vm_dump.o vm_trace.o probes.o enc/ascii.o enc/us_ascii.o enc/unicode.o enc/utf_8.o enc/trans/newline.o sparc.o explicit_bzero.o flock.o isinf.o setproctitle.o addr2line.o -lpthread -lrt -lrt -lrt -lgmp -lsocket -ldl -lcrypt -lm -lm -o miniruby Undefined first referenced symbol in file .L10394 iseq.o .L10395 iseq.o .L10396 iseq.o .L10397 iseq.o .L10398 iseq.o .L10399 iseq.o .L10400 iseq.o .L10401 iseq.o .L10402 iseq.o .L10403 iseq.o ld: fatal: symbol referencing errors. No output written to miniruby make: *** [miniruby] Error 2 ~~~ ---------------------------------------- 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-74825 * Author: ngoto (Naohisa Goto) * Status: Open * 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/