https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112012-01-07T05:41:27ZRuby Issue Tracking SystemBackport193 - Backport #5851: make check fails when compiling with GCC 4.7 - *** longjmp causes uninitialized stack frame ***https://redmine.ruby-lang.org/issues/5851?journal_id=231402012-01-07T05:41:27Zkosaki (Motohiro KOSAKI)kosaki.motohiro@gmail.com
<ul></ul><p>Please send us patch.</p> Backport193 - Backport #5851: make check fails when compiling with GCC 4.7 - *** longjmp causes uninitialized stack frame ***https://redmine.ruby-lang.org/issues/5851?journal_id=231412012-01-07T05:44:59Zluislavena (Luis Lavena)luislavena@gmail.com
<ul></ul><p>Can you provide a simple example that reproduces this?</p>
<p>Have you tried compiling with debug symbols and go over GDB?</p>
<p>Can you provide information of the resulting GCC flags of configure that were used to generate the libruby.so and ruby executable?</p>
<p>Have you tried -fno-omit-frame-pointer?</p> Backport193 - Backport #5851: make check fails when compiling with GCC 4.7 - *** longjmp causes uninitialized stack frame ***https://redmine.ruby-lang.org/issues/5851?journal_id=231972012-01-09T20:54:02Zvo.x (Vit Ondruch)v.ondruch@tiscali.cz
<ul></ul><p>Hi Luis,</p>
<p>You can find the GCC glags in the build.log [1]. I was using the following settings: CFLAGS='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables'. I will try the flags you are suggesting.</p>
<p>BTW with -O0, it passes (unfortunately fails in other test) and with -O1, I get a bit more verbose output [2]. And this [3] is the backtrace I obtained using GBD.</p>
<p>[1] <a href="http://koji.fedoraproject.org/koji/getfile?taskID=3624341&name=build.log" class="external">http://koji.fedoraproject.org/koji/getfile?taskID=3624341&name=build.log</a><br>
[2] <a href="https://gist.github.com/1582632" class="external">https://gist.github.com/1582632</a><br>
[3] <a href="https://gist.github.com/1582640" class="external">https://gist.github.com/1582640</a></p> Backport193 - Backport #5851: make check fails when compiling with GCC 4.7 - *** longjmp causes uninitialized stack frame ***https://redmine.ruby-lang.org/issues/5851?journal_id=232022012-01-10T01:56:52Zvo.x (Vit Ondruch)v.ondruch@tiscali.cz
<ul></ul><p>It reminds me issue <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: Continuation causes Bus Error on Debian sparc (Closed)" href="https://redmine.ruby-lang.org/issues/5244">#5244</a>. I would say that the _setjmp/_longjmp is causing the troubles, but I am not yet sure why :/</p> Backport193 - Backport #5851: make check fails when compiling with GCC 4.7 - *** longjmp causes uninitialized stack frame ***https://redmine.ruby-lang.org/issues/5851?journal_id=232142012-01-10T12:12:30Znaruse (Yui NARUSE)naruse@airemix.jp
<ul></ul><p>It works on FreeBSD 9.0 amd 64 with gcc47 (FreeBSD Ports Collection) 4.7.0 20111217 (experimental)</p> Backport193 - Backport #5851: make check fails when compiling with GCC 4.7 - *** longjmp causes uninitialized stack frame ***https://redmine.ruby-lang.org/issues/5851?journal_id=232202012-01-10T17:15:59ZAnonymous
<ul></ul><p>This test fails for me, too - using "gcc version 4.7.0 20120106 (Red Hat 4.7.0-0.5) (GCC)".<br>
If I, however, compile the file cont.c with CFLAG -O0, the test passes, so I guess the problem has to be somewhere in it.</p> Backport193 - Backport #5851: make check fails when compiling with GCC 4.7 - *** longjmp causes uninitialized stack frame ***https://redmine.ruby-lang.org/issues/5851?journal_id=232512012-01-12T00:14:04Zvo.x (Vit Ondruch)v.ondruch@tiscali.cz
<ul></ul><p>Valgrind output when compiling with -O1:</p>
<a name="Running-tests"></a>
<h1 >Running tests:<a href="#Running-tests" class="wiki-anchor">¶</a></h1>
<p>==8685== Invalid write of size 8<br>
==8685== at 0x4FDA9E8: cont_restore_1 (cont.c:675)<br>
==8685== by 0x4FDAA12: cont_restore_0 (cont.c:771)<br>
==8685== by 0x4FDAB0E: rb_cont_call (cont.c:910)<br>
==8685== by 0x4FB8D90: call_cfunc (vm_insnhelper.c:317)<br>
==8685== by 0x4FB96A8: vm_call_cfunc (vm_insnhelper.c:404)<br>
==8685== by 0x4FB9D7F: vm_call_method (vm_insnhelper.c:534)<br>
==8685== by 0x4FBF772: vm_exec_core (insns.def:1015)<br>
==8685== by 0x4FCCF77: vm_exec (vm.c:1220)<br>
==8685== by 0x4FCB870: invoke_block_from_c (vm.c:624)<br>
==8685== by 0x4FCB986: vm_yield (vm.c:654)<br>
==8685== by 0x4FC7D93: rb_yield_0 (vm_eval.c:740)<br>
==8685== by 0x4FC7DCD: rb_yield (vm_eval.c:750)<br>
==8685== Address 0x7feffad00 is not stack'd, malloc'd or (recently) free'd<br>
==8685==<br>
*** longjmp causes uninitialized stack frame ***: ./ruby terminated</p> Backport193 - Backport #5851: make check fails when compiling with GCC 4.7 - *** longjmp causes uninitialized stack frame ***https://redmine.ruby-lang.org/issues/5851?journal_id=232732012-01-12T13:33:15Znaruse (Yui NARUSE)naruse@airemix.jp
<ul></ul><p>Can you disassemble cont_restore_0?<br>
I doubt your gcc 4.7 optimized out the content of cont_restore_0.</p> Backport193 - Backport #5851: make check fails when compiling with GCC 4.7 - *** longjmp causes uninitialized stack frame ***https://redmine.ruby-lang.org/issues/5851?journal_id=232742012-01-12T14:16:31Znaruse (Yui NARUSE)naruse@airemix.jp
<ul></ul><p>Yui NARUSE wrote:</p>
<blockquote>
<p>Can you disassemble cont_restore_0?<br>
I doubt your gcc 4.7 optimized out the content of cont_restore_0.</p>
</blockquote>
<p>Maybe r34278 fixes this.</p> Backport193 - Backport #5851: make check fails when compiling with GCC 4.7 - *** longjmp causes uninitialized stack frame ***https://redmine.ruby-lang.org/issues/5851?journal_id=232792012-01-12T19:06:42Zvo.x (Vit Ondruch)v.ondruch@tiscali.cz
<ul></ul><p>Yes, it fixes the SEGV it seems. Thank you! Could you backport it for 1.9.3? Should I open new ticket for backport?</p> Backport193 - Backport #5851: make check fails when compiling with GCC 4.7 - *** longjmp causes uninitialized stack frame ***https://redmine.ruby-lang.org/issues/5851?journal_id=232802012-01-12T19:19:03Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Tracker</strong> changed from <i>Bug</i> to <i>Backport</i></li><li><strong>Project</strong> changed from <i>Ruby master</i> to <i>Backport193</i></li></ul> Backport193 - Backport #5851: make check fails when compiling with GCC 4.7 - *** longjmp causes uninitialized stack frame ***https://redmine.ruby-lang.org/issues/5851?journal_id=232882012-01-13T04:08:12Zkosaki (Motohiro KOSAKI)kosaki.motohiro@gmail.com
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>backported as r34288.</p>