https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112021-06-12T13:34:37ZRuby Issue Tracking SystemRuby master - Bug #17949: [SOLARIS11, SPARC, SEGFAULT] generating encdb.hhttps://bugs.ruby-lang.org/issues/17949?journal_id=924262021-06-12T13:34:37Ztankf33der (Mike P)
<ul></ul><p>The simplest way to crash miniruby is exec and press Ctrl-D inside it as input.</p> Ruby master - Bug #17949: [SOLARIS11, SPARC, SEGFAULT] generating encdb.hhttps://bugs.ruby-lang.org/issues/17949?journal_id=924272021-06-12T16:21:56Zxtkoba (Tee KOBAYASHI)
<ul><li><strong>File</strong> <a href="/attachments/8910">ruby-clang-setjmp-var_from_memory.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/8910/ruby-clang-setjmp-var_from_memory.patch">ruby-clang-setjmp-var_from_memory.patch</a> added</li></ul><p>From <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: [SOLARIS11, SPARC] time.c compilation failed (Closed)" href="https://bugs.ruby-lang.org/issues/17947">#17947</a> I guess that Clang/LLVM is used as the compiler. There are some possible workarounds that I can think of, from my experience with Clang/LLVM and <code>setjmp</code>/<code>longjmp</code>.</p>
<ul>
<li>
<p><code>__builtin_setjmp</code> is enabled for <code>sparc-sun-solaris</code> target by default. It can be sometimes troublesome (<a class="issue tracker-1 status-1 priority-4 priority-default" title="Bug: miniruby crashing when compiled with -O2 or -O1 on aarch64 (Open)" href="https://bugs.ruby-lang.org/issues/14480#note-15">#14480#note-15</a>). Tell the configure script not to use it: <code>./configure ac_cv_func___builtin_setjmp=no</code></p>
</li>
<li>
<p>It is known that older versions of Clang/LLVM sometimes produces buggy codes around (non-builtin) <code>setjmp</code> when optimizations are enabled. See <a href="https://reviews.llvm.org/D77767" class="external">https://reviews.llvm.org/D77767</a> for example. Check whether <code>./configure optflags=-O0 ac_cv_func___builtin_setjmp=no</code> works.</p>
</li>
<li>
<p>To workaround the previous bug and simultaneously enable optimizations, add the statement <code>VAR_FROM_MEMORY(var);</code> for each local variable <code>var</code> of which the value is read after the second return (by <code>longjmp</code>) of <code>setjmp</code>. This statement must be placed after the second return of <code>setjmp</code> and before read. A sample patch is attached for that. Then see if <code>./configure ac_cv_func___builtin_setjmp=no</code> works.</p>
</li>
</ul> Ruby master - Bug #17949: [SOLARIS11, SPARC, SEGFAULT] generating encdb.hhttps://bugs.ruby-lang.org/issues/17949?journal_id=924292021-06-13T06:36:56Ztankf33der (Mike P)
<ul></ul><p>You were right, this is llvm's issue.<br>
Ruby successfully passed all tests under GCC on Solaris SPARC.</p>
<pre><code>...
...
PASS all 1488 tests
exec ./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems "./bootstraptest/runner.rb" --ruby="ruby --disable-gems" ./KNOWNBUGS.rb
2021-06-13 09:29:28 +0300
Driver is ruby 3.1.0dev (2021-06-10T23:31:51Z master 9210f8df7f) [sparc-solaris2.11]
Target is ruby 3.1.0dev (2021-06-10T23:31:51Z master 9210f8df7f) [sparc-solaris2.11]
KNOWNBUGS.rb PASS 0
No tests, no problem
test succeeded
$
</code></pre> Ruby master - Bug #17949: [SOLARIS11, SPARC, SEGFAULT] generating encdb.hhttps://bugs.ruby-lang.org/issues/17949?journal_id=924302021-06-13T06:38:27Ztankf33der (Mike P)
<ul></ul><p>Please disable default clang-llvm selection by default on Solaris.<br>
All tests above passed with <code>CC=gcc ./configure --enable-shared --disable-rpath</code>.</p> Ruby master - Bug #17949: [SOLARIS11, SPARC, SEGFAULT] generating encdb.hhttps://bugs.ruby-lang.org/issues/17949?journal_id=924872021-06-15T13:18:14Ztankf33der (Mike P)
<ul></ul><p>I believe this issue could be closed.<br>
Fix already in the tree:<br>
<a href="https://github.com/ruby/ruby/commit/90cad6e14745d812f042df61a6455db022be7389" class="external">https://github.com/ruby/ruby/commit/90cad6e14745d812f042df61a6455db022be7389</a></p> Ruby master - Bug #17949: [SOLARIS11, SPARC, SEGFAULT] generating encdb.hhttps://bugs.ruby-lang.org/issues/17949?journal_id=924892021-06-15T14:43:40Zjeremyevans0 (Jeremy Evans)merch-redmine@jeremyevans.net
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul> Ruby master - Bug #17949: [SOLARIS11, SPARC, SEGFAULT] generating encdb.hhttps://bugs.ruby-lang.org/issues/17949?journal_id=932932021-08-16T10:35:18Zxtkoba (Tee KOBAYASHI)
<ul></ul><p>Just FTR, Clang/LLVM <code>__builtin_longjmp</code> is broken for Sparc targets: <a href="https://bugs.llvm.org/show_bug.cgi?id=51489" class="external">https://bugs.llvm.org/show_bug.cgi?id=51489</a></p>