[ruby-dev:49331] [Ruby trunk - Bug #11644] Since r52055, TestMkmf::TestConvertible failed on Solaris 10 with fcc
From:
ngotogenome@...
Date:
2015-11-03 13:28:47 UTC
List:
ruby-dev #49331
Issue #11644 has been updated by Naohisa Goto.
コマンドラインは正常だったので、やはりWarningが出たのが原因のようです。
以下のようにキャストするとFailureは出なくなりました。
(三項演算子のどちらか片方だけのキャストではダメでした。)
しかし、古いバージョンのコンパイラのバグっぽい挙動のために、全環境でキャストを入れるのは、
将来の型変更時のミス等を隠蔽するため有害な気がするので、
#ifdef 等で環境・コンパイラを限定してキャストするのがよいかと思っています。
~~~
--- include/ruby/ruby.h~ 2015-11-02 23:46:44.317989704 +0900
+++ include/ruby/ruby.h 2015-11-03 20:27:45.085567608 +0900
@@ -2007,8 +2007,8 @@
static inline const VALUE *
rb_array_const_ptr(VALUE a)
{
- return (RBASIC(a)->flags & RARRAY_EMBED_FLAG) ?
- RARRAY(a)->as.ary : RARRAY(a)->as.heap.ptr;
+ return (const VALUE *)((RBASIC(a)->flags & RARRAY_EMBED_FLAG) ?
+ RARRAY(a)->as.ary : RARRAY(a)->as.heap.ptr);
}
static inline long
@@ -2021,8 +2021,8 @@
static inline const VALUE *
rb_struct_const_ptr(VALUE st)
{
- return (RBASIC(st)->flags & RSTRUCT_EMBED_LEN_MASK) ?
- RSTRUCT(st)->as.ary : RSTRUCT(st)->as.heap.ptr;
+ return (const VALUE *)((RBASIC(st)->flags & RSTRUCT_EMBED_LEN_MASK) ?
+ RSTRUCT(st)->as.ary : RSTRUCT(st)->as.heap.ptr);
}
#if defined(EXTLIB) && defined(USE_DLN_A_OUT)
~~~
----------------------------------------
Bug #11644: Since r52055, TestMkmf::TestConvertible failed on Solaris 10 with fcc
https://bugs.ruby-lang.org/issues/11644#change-54691
* Author: Naohisa Goto
* Status: Feedback
* Priority: Normal
* Assignee:
* ruby -v: ruby 2.3.0dev (2015-10-06) [sparc64-solaris2.10]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
r52055以降、Solaris 10 上の古いfcc (Fujitsu C Compiler) にてコンパイルすると、
make test-all にて
TestMkmf::TestConvertible#test_typeof_builtin
TestMkmf::TestConvertible#test_typeof_typedef
がfailureになります。
長いのでFailure部分のログはファイル(r52055-failure.log)にて添付します。
以下のようにポインタの型の不一致のWarningが出ているのが原因でしょうか?
~~~
"/XXXXX-52055/include/ruby/ruby.h", line 2003: warning: return incompatible pointer types: expected `const VALUE *' actual `const unsigned long *' in function `rb_array_const_ptr'
"/XXXXX-52055/include/ruby/ruby.h", line 2017: warning: return incompatible pointer types: expected `const VALUE *' actual `const unsigned long *' in function `rb_struct_const_ptr'
~~~
なお、Oracle Solaris Studio 12.3 など他のコンパイラではFailureにならず成功しています。
---Files--------------------------------
r52055-failure.log (8.02 KB)
--
https://bugs.ruby-lang.org/