[#84867] [Ruby trunk Bug#14357] thread_safe tests suite segfaults — v.ondruch@...
Issue #14357 has been reported by vo.x (Vit Ondruch).
11 messages
2018/01/15
[#85364] Re: [Ruby trunk Bug#14357] thread_safe tests suite segfaults
— Eric Wong <normalperson@...>
2018/02/03
v.ondruch@tiscali.cz wrote:
[#85368] Re: [Ruby trunk Bug#14357] thread_safe tests suite segfaults
— Eric Wong <normalperson@...>
2018/02/03
Eric Wong wrote:
[#85442] Re: [Ruby trunk Bug#14357] thread_safe tests suite segfaults
— Eric Wong <normalperson@...>
2018/02/06
Eric Wong <normalperson@yhbt.net> wrote:
[#85451] Re: [Ruby trunk Bug#14357] thread_safe tests suite segfaults
— Vladimir Makarov <vmakarov@...>
2018/02/06
On 02/06/2018 05:00 AM, Eric Wong wrote:
[#84874] [Ruby trunk Bug#14360] Regression CSV#open method for writing from Ruby 2.4.3 to 2.5.0 — shevegen@...
Issue #14360 has been updated by shevegen (Robert A. Heiler).
3 messages
2018/01/15
[#84980] [Ruby trunk Feature#13618][Assigned] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid — hsbt@...
Issue #13618 has been updated by hsbt (Hiroshi SHIBATA).
10 messages
2018/01/23
[#85012] Re: [Ruby trunk Feature#13618][Assigned] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid
— Eric Wong <normalperson@...>
2018/01/23
hsbt@ruby-lang.org wrote:
[#85081] Re: [Ruby trunk Feature#13618][Assigned] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid
— Eric Wong <normalperson@...>
2018/01/24
Eric Wong <normalperson@yhbt.net> wrote:
[#85082] Re: [Ruby trunk Feature#13618][Assigned] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid
— Eric Wong <normalperson@...>
2018/01/24
> Thinking about this even more; I don't think it's possible to
[#85088] [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid — danieldasilvaferreira@...
Issue #13618 has been updated by dsferreira (Daniel Ferreira).
3 messages
2018/01/25
[#85107] [Ruby trunk Misc#14222] Mutex.lock is not safe inside signal handler: what is? — eregontp@...
Issue #14222 has been updated by Eregon (Benoit Daloze).
3 messages
2018/01/25
[#85136] Re: [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid — Eric Wong <normalperson@...>
samuel@oriontransfer.org wrote:
3 messages
2018/01/26
[ruby-core:84585] [Ruby trunk Bug#14260] test failure related with proc arity on 32-bit environment (e.g. Solaris 10 with 32-bit compile)
From:
shyouhei@...
Date:
2018-01-02 06:59:20 UTC
List:
ruby-core #84585
Issue #14260 has been updated by shyouhei (Shyouhei Urabe).
ngoto (Naohisa Goto) wrote:
> >> ビットフィールドのデフォルトは unsigned int というのがCの規格にて定められていますが、
>
> >ごめんなさい、いま家にいてCの規格にアクセスできないのですが、そのような規定があった記憶がないです。どこのセクションに書いてありましたでしょうか?
>
> ご指摘のとおり、元の記述は間違いでした。
> 正しくは implementation-defined でしたので訂正します。ご指摘ありがとうございました。
>
> 原本は私も手元には無いのですが、C99 では 6.7.2.1 に書かれているとのことです。
> 参考にしたページ: http://en.cppreference.com/w/c/language/bit_field
>
> Oracle Solaris Studio や IBM のコンパイラでは未指定のintは unsigned 扱いになるとの記述を見つけていたこともあり、勘違いしていました。
>
> Oracle: https://docs.oracle.com/cd/E19205-01/820-1209/bjayo/index.html
>
> IBM: https://www.ibm.com/support/knowledgecenter/en/SSQ2R2_8.5.1/com.ibm.tpf.toolkit.compilers.doc/ref/langref_zos/clrc03defbitf.htm
>
> 一方、GCCでは singed とのことです。
> https://gcc.gnu.org/onlinedocs/gcc-5.2.0/gcc/Structures-unions-enumerations-and-bit-fields-implementation.html
>
> なお、(少なくとも最近の) GCC や Oracle Developer Studio ではコンパイル時のオプションで変更可能とのことです。
調査していただいてありがとうございました。そのような状況であれば裸のintの利用は控えてsignedかunsignedを明示したほうが良さそうですね。修正は妥当そうだと思いました。
----------------------------------------
Bug #14260: test failure related with proc arity on 32-bit environment (e.g. Solaris 10 with 32-bit compile)
https://bugs.ruby-lang.org/issues/14260#change-69124
* Author: ngoto (Naohisa Goto)
* Status: Closed
* Priority: Normal
* Assignee:
* Target version:
* ruby -v:
* Backport: 2.3: DONTNEED, 2.4: DONTNEED, 2.5: REQUIRED
----------------------------------------
おそらく r59358 以降、sparc の Solaris 10 上の Oracle Developer Studio (Oracle Solaris Studio) 12.x にて 32ビットでコンパイルした際、
make test-all にて以下のような failure が出るようになりました。
(以下は r61515 での結果)
~~~
1) Failure:
TestLazyEnumerator#test_each_cons_limit [/XXXXX/test/ruby/test_lazy_enumerator.rb:548]:
<[[1, 2], [2, 3]]> expected but was
<[[2, 3], [2, 3]]>.
2) Failure:
TestProc#test_bound_parameters [/XXXXX/test/ruby/test_proc.rb:1184]:
<[[:rest]]> expected but was
<[]>.
3) Failure:
TestEnumerator#test_cons [/XXXXX/test/ruby/test_enumerator.rb:118]:
<[[1, 2, 3],
[2, 3, 4],
[3, 4, 5],
[4, 5, 6],
[5, 6, 7],
[6, 7, 8],
[7, 8, 9],
[8, 9, 10]]> expected but was
<[[8, 9, 10],
[8, 9, 10],
[8, 9, 10],
[8, 9, 10],
[8, 9, 10],
[8, 9, 10],
[8, 9, 10],
[8, 9, 10]]>.
4) Failure:
TestEnumerator#test_slice [/XXXXX/test/ruby/test_enumerator.rb:113]:
<[[1, 2, 3], [4, 5, 6], [7, 8, 9], [10]]> expected but was
<[[10], [10], [10], [10]]>.
(中略)
6) Failure:
TestProc#test_arity2 [/XXXXX/test/ruby/test_proc.rb:439]:
<-1> expected but was
<0>.
7) Failure:
TestLazyEnumerator#test_each_slice_limit [/XXXXX/test/ruby/test_lazy_enumerator.rb:554]:
<[[1, 2], [3, 4]]> expected but was
<[[3, 4], [3, 4]]>.
(後略)
~~~
結論から言うと以下のパッチで治りました。
ビットフィールドのデフォルトは unsigned int というのがCの規格にて定められていますが、
max に -1 (マクロ UNLIMITED_ARGUMENTS の値)が代入される場合があり、
これが unsigned int : 16 では 65535 が代入されたのと同じビット列になり、
それを再度 signed int に戻す際に、そのまま 65535 が戻され、つまり意図しない値に化けてしまい、
(ここらへんの処理は、Cの規格ではおそらく処理系依存とされていると思います)
arityを UNLIMITED_ARGUMENTS や 0 と比較する判定結果が異常になり、
上記のFailureが発生したようです。
なお、64ビットでコンパイルすると `#else` 以下の `int min, max;` が使われ、ビットフィールドではなくなるため、このFailreは発生しません。
また、gcc では 16 ビットのまま符号ありの -1 にしてから戻してくれる(場合もある?)ようで、(大部分の?)Failureは発生しないようです(が一部おかしい部分があったっぽい?)。
~~~
--- internal.h (revision 61515)
+++ internal.h (working copy)
@@ -912,12 +912,12 @@
/* IFUNC (Internal FUNCtion) */
struct vm_ifunc_argc {
#if SIZEOF_INT * 2 > SIZEOF_VALUE
- int min: (SIZEOF_VALUE * CHAR_BIT) / 2;
- int max: (SIZEOF_VALUE * CHAR_BIT) / 2;
+ signed int min: (SIZEOF_VALUE * CHAR_BIT) / 2;
+ signed int max: (SIZEOF_VALUE * CHAR_BIT) / 2;
#else
int min, max;
#endif
};
~~~
今回、Failureが発生したのは Solaris だけですが、全ての32ビット環境にて潜在的に問題が発生する可能性があるコードだったと言えます。
そして、ビットフィールドでメモリを節約している箇所は他にも複数あると思いますが、unsigned int 扱いで確かに正しいか、負の値を意図せず代入していないか、念のため総点検する必要があるかもしれないと思いました。
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>