[LLVMbugs] [Bug 8319] New: clang -O can't build ruby trunk
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Oct 6 18:55:43 PDT 2010
http://llvm.org/bugs/show_bug.cgi?id=8319
Summary: clang -O can't build ruby trunk
Product: clang
Version: trunk
Platform: PC
OS/Version: FreeBSD
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: naruse at airemix.jp
CC: llvmbugs at cs.uiuc.edu
clang -O can't build ruby trunk, but clang -O0 can build ruby trunk.
So it seems some optimization breaks ruby.
Ruby's code can be obtain from http://svn.ruby-lang.org/
and I tried with following:
--
Ruby: r29419 on x86_64-freebsd8.1
clang version 2.9 (trunk 115816)
Target: x86_64-unknown-freebsd8.1
Thread model: posix
--
And its build process will crashes like following:
--
snipped...
/home/naruse/local/llvm/bin/clang -O -g -Wall -pedantic -Wno-long-long -Wno-gnu
-Wno-unknown-pragmas -fPIC -I. -I.ext/include/x86_64-freebsd8.1
-I../../src/ruby-trunk/include -I../../src/ruby-trunk -include ruby/config.h
-include ruby/missing.h -fvisibility=hidden -DRUBY_EXPORT -o dmyext.o -c
../../src/ruby-trunk/dmyext.c
/home/naruse/local/llvm/bin/clang -O -g -Wall -pedantic -Wno-long-long -Wno-gnu
-Wno-unknown-pragmas -fPIC -L. -rdynamic main.o dmydln.o dmyencoding.o
dmyversion.o miniprelude.o array.o bignum.o class.o compar.o complex.o
dir.o dln_find.o enum.o enumerator.o error.o eval.o load.o proc.o
file.o gc.o hash.o inits.o io.o marshal.o math.o node.o numeric.o
object.o pack.o parse.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 time.o
transcode.o util.o variable.o compile.o debug.o iseq.o vm.o vm_dump.o
thread.o cont.o ascii.o us_ascii.o unicode.o utf_8.o newline.o close.o
dmyext.o -lthr -lrt -lcrypt -lm -o miniruby
clang: warning: argument unused during compilation: '-g'
clang: warning: argument unused during compilation: '-rdynamic'
/usr/local/bin/ld: error in /usr/lib/crtend.o(.eh_frame); no .eh_frame_hdr
table will be created.
<internal:prelude>:1: [BUG] Segmentation fault
ruby 1.9.3dev (2010-10-07 trunk 29420) [x86_64-freebsd8.1]
-- control frame ----------
c:0003 p:0002 s:0006 b:0006 l:000005 d:000005 TOP <internal:prelude>:1
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:0008e8 d:0008e8 TOP
---------------------------
-- Ruby level backtrace information ----------------------------------------
<internal:prelude>:1:in `<compiled>'
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
*** Signal 6
Stop in /home/naruse/obj/ruby-clang.
--
The crashed binary, miniruby, is a ruby subset binary to make full ruby's
files.
In my understanding, it is happend on insns.def:868.
--
860 DEFINE_INSN
861 trace
862 (rb_num_t nf)
863 ()
864 ()
865 {
866 rb_event_flag_t flag = (rb_event_flag_t)nf;
867
868 EXEC_EVENT_HOOK(th, flag, GET_SELF(), 0, 0 /* TODO: id, klass */);
869 }
--
And this GET_SELF() is:vm_insnhelper.h:146:
#define GET_SELF() (USAGE_ANALYSIS_REGISTER_HELPER(5, 0, GET_CFP()->self))
GET_CFP() is:
112 #define GET_CFP() (USAGE_ANALYSIS_REGISTER_HELPER(2, 0, REG_CFP))
REG_CFP is:
81 #define REG_CFP (reg_cfp)
This reg_cfp's value is vanished on clang -O, and crash.
If I change Ruby's code as it uses reg_cfp before this, clang seems not
optimize reg_cfp and ruby works well.
--- insns.def (revision 29420)
+++ insns.def (working copy)
@@ -864,6 +864,7 @@
()
{
rb_event_flag_t flag = (rb_event_flag_t)nf;
+ if (!reg_cfp) sleep(1);
EXEC_EVENT_HOOK(th, flag, GET_SELF(), 0, 0 /* TODO: id, klass */);
}
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list