hughperman / pure-lang

Automatically exported from code.google.com/p/pure-lang
0 stars 0 forks source link

segmentation fault with Ubuntu 9.04 and LLVM 2.5 #9

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Install Ubuntu 9.04 and LLVM 2.5 (with dev package)
2. Download pure-0.22.tar.gz
3. ./configure --prefix=/opt/pure
4. make
5. LD_LIBRARY_PATH=. ./pure
6. >> sq x = x*x;
7. >> sq 5;

What is the expected output? What do you see instead?
I expect 25, but get a segmentation fault. Stack trace:

#0  0xb7722ff8 in X86CompilationCallback2@plt () from ./libpure.so.0
#1  0xb7a18a09 in X86CompilationCallback_SSE () from ./libpure.so.0
#2  0xb607201c in ?? ()
#3  0xb6072073 in ?? ()
#4  0xb7786ed4 in interpreter::doeval (this=0xb5bc50b8, x=
      {p = 0xbfa2f044, static h = {_M_t = {_M_impl =
{<std::allocator<std::_Rb_tree_node<std::pair<EXPR* const, unsigned int> >
>> = {<__gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<EXPR* const,
unsigned int> > >> = {<No data fields>}, <No data fields>}, _M_key_compare
= {<std::binary_function<EXPR*, EXPR*, bool>> = {<No data fields>}, <No
data fields>}, _M_header = {_M_color = std::_S_red, _M_parent = 0x0,
_M_left = 0xb800e42c, _M_right = 0xb800e42c}, _M_node_count = 0}}}, static
key = 0}, e=@0xbfa2f150) at interpreter.cc:5324
#5  0xb778864e in interpreter::eval (this=0xbfa2f83c, x=@0x999b390,
e=@0xbfa2f150) at interpreter.cc:1080
#6  0xb77887e4 in interpreter::exec (this=0xbfa2f83c, x=0x999b390) at
interpreter.cc:1658
#7  0xb78943c6 in yy::parser::parse (this=0xbfa2f700) at parser.yy:276
#8  0xb7758206 in interpreter::run (this=0xbfa2f83c, _s=@0xbfa2fbcc,
check=false, sticky=false) at interpreter.cc:960
#9  0x0804caa5 in main (argc=-3, argv=0xbfa30758) at pure.cc:638

What version of the product are you using? On what operating system?

pure 0.22
LLVM 2.5

Please provide any additional information below.

Of course, make check failed.

Original issue reported on code.google.com by deback...@gmail.com on 7 May 2009 at 11:26

GoogleCodeExporter commented 8 years ago
Just to make sure, what system (cpu) did you run the tests on? From what what I 
see,
it should be x86 or x86_64?

Original comment by aggraef@gmail.com on 7 May 2009 at 6:57

GoogleCodeExporter commented 8 years ago
It is 32 bit Ubuntu, running on a "Intel(R) Core(TM)2 Duo CPU     E4500  @ 
2.20GHz"
which is 64 bit.

Original comment by deback...@gmail.com on 8 May 2009 at 7:29

GoogleCodeExporter commented 8 years ago
Also it is running inside a VMWare Workstation 6.5 running on Win XP 32 bit.

Original comment by deback...@gmail.com on 8 May 2009 at 7:30

GoogleCodeExporter commented 8 years ago
Ok, to summarize: you're running 32 bit Ubuntu 9.04 virtualized using VMWare 
6.5 in
32 bit Windows XP on a 64 bit cpu, is that right?

Does the native Windows port of Pure work on your Windows XP system? There's an 
MSI
for that in the Pure download area.

I don't use Ubuntu myself, but I know that several people have compiled LLVM 
2.5 on
64 bit Ubuntu and use Pure there without problems. I've also run Pure on 32 bit 
Linux
(SUSE) on a 64 bit system (AMD) and that works without hitches, too.

The error message looks like it's actually an issue with the LLVM JIT. So I 
think
that we should first rule out that it's a broken LLVM package. For that you'd 
have to
uninstall the Ubuntu LLVM packages and compile LLVM 2.5 yourself. You only need
llvm-2.5.tar.gz for that. Instructions for compiling and installing this 
package are
contained in the INSTALL file in the Pure sources.

Original comment by aggraef@gmail.com on 9 May 2009 at 5:12

GoogleCodeExporter commented 8 years ago
Yes, you're right. And, yes the Windows port works fine :)

Original comment by deback...@gmail.com on 9 May 2009 at 5:19

GoogleCodeExporter commented 8 years ago
Perhaps this helps:
I run pure on Ubuntu without problems.
However it's x86_64.
I just replaced the manual installed llvm with the Ubuntu package.
Works fine as well.

Original comment by 23.14...@gmail.com on 11 May 2009 at 6:38

GoogleCodeExporter commented 8 years ago
What about Pure + manually compiled LLVM 2.5 on 32 bit Ubuntu? Did that still 
exhibit
the same problem?

Original comment by aggraef@gmail.com on 11 May 2009 at 7:33

GoogleCodeExporter commented 8 years ago
We discussed this on the mailing list. See
http://groups.google.com/group/pure-lang/browse_thread/thread/13b80eb26eb43255

As Max Wolf, who is also running Jaunty on a 32 bit cpu, reported, the issue 
arises
with the LLVM 2.5 package, manually compiled LLVM works fine. I also took a 
look at
the LLVM 2.5 source package at http://packages.ubuntu.com/jaunty/llvm, and 
noticed
that the --with-pic --enable-pic configure options are used unconditionally, 
which is
probably the cause of the issue.

Original comment by aggraef@gmail.com on 15 May 2009 at 9:48

GoogleCodeExporter commented 8 years ago
I just wanted to add that it's confirmed that this is actually a problem in the 
LLVM
JIT, which breaks on x86-32 if it is built with --enable-pic. More information 
and
patch against the LLVM sources here:

http://llvm.org/bugs/show_bug.cgi?id=3239

I hope that this will be fixed in LLVM 2.6.

Original comment by aggraef@gmail.com on 29 May 2009 at 10:46

GoogleCodeExporter commented 8 years ago
Just FYI, I am seeing this same problem on LLVM 2.4, Fedora core 10, x86-32.

I don't know if this has been built with --enable-pic, but here is the RPM info 
for llvm:

Name        : llvm                         Relocations: (not relocatable)
Version     : 2.4                               Vendor: Fedora Project
Release     : 4.fc10                        Build Date: Thu 05 Mar 2009 
07:11:29 AM IST
Install Date: Sun 31 May 2009 01:55:24 PM IST      Build Host:
xenbuilder2.fedora.redhat.com
Group       : Development/Languages         Source RPM: llvm-2.4-4.fc10.src.rpm
Size        : 50839735                         License: NCSA
Signature   : DSA/SHA1, Fri 13 Mar 2009 06:24:46 PM IST, Key ID bf226fcc4ebfc273
Packager    : Fedora Project
URL         : http://llvm.org/
Summary     : The Low Level Virtual Machine

Original comment by harshad...@gmail.com on 2 Jun 2009 at 6:13

GoogleCodeExporter commented 8 years ago
Yes, --enable-pic is hardcoded into the %build step of the FC10 llvm-2.4-4 
package, I
checked that by looking at the spec file in the source rpm. So the package 
won't work
on x86 either. I'd suggest to build your own LLVM (either 2.5, or the latest 
svn;
make sure to specify --disable-pic with the latter until
http://llvm.org/bugs/show_bug.cgi?id=3239 is fixed). There have been many
improvements in the JIT since LLVM 2.4, so going with LLVM 2.5 or later is
recommended anyway.

Original comment by aggraef@gmail.com on 2 Jun 2009 at 10:51

GoogleCodeExporter commented 8 years ago
Issue 11 has been merged into this issue.

Original comment by aggraef@gmail.com on 27 Aug 2009 at 5:20