Bug 24006 - AOT on IronPython causes an assert/core dump with -O=all
Summary: AOT on IronPython causes an assert/core dump with -O=all
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: JIT ()
Version: 3.8.0
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-10-22 19:32 UTC by Craig Minihan
Modified: 2014-10-24 19:22 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Craig Minihan 2014-10-22 19:32:49 UTC
Running an AOT pass on IronPython.DLL (http://ironpython.codeplex.com/downloads/get/723207) causes an assertion as follows:

$ mono --aot -O=all IronPython.dll 
Mono Ahead of Time compiler - compiling assembly /home/.../IronPython.dll
* Assertion at method-to-ir.c:13450, condition `((sreg == -1) && (regtype == ' ')) || ((sreg != -1) && (regtype != ' '))' not met

Stacktrace:


Native stacktrace:

	mono() [0x4a4d75]
	/lib64/libpthread.so.0() [0x342880f500]
	/lib64/libc.so.6(gsignal+0x35) [0x37dfe328a5]
	/lib64/libc.so.6(abort+0x175) [0x37dfe34085]
	mono() [0x637d1d]
	mono() [0x637dc7]
	mono() [0x42a797]
	mono() [0x41cceb]
	mono() [0x485c23]
	mono() [0x48684e]
	mono() [0x48fae5]
	mono(mono_main+0x1196) [0x47c766]
	/lib64/libc.so.6(__libc_start_main+0xfd) [0x37dfe1ecdd]
	mono() [0x4130d9]

Debug info from gdb:

Mono support loaded.
[New LWP 14595]
[Thread debugging using libthread_db enabled]
0x000000342880f09d in waitpid () from /lib64/libpthread.so.0
  2 Thread 0x7fb000857700 (LWP 14595)  0x000000342880d720 in sem_wait () from /lib64/libpthread.so.0
* 1 Thread 0x7fb007f38780 (LWP 14594)  0x000000342880f09d in waitpid () from /lib64/libpthread.so.0

Thread 2 (Thread 0x7fb000857700 (LWP 14595)):
#0  0x000000342880d720 in sem_wait () from /lib64/libpthread.so.0
#1  0x000000000062dad8 in mono_sem_wait (sem=0x97a000, alertable=1) at mono-semaphore.c:101
#2  0x00000000005a62b9 in finalizer_thread (unused=<value optimized out>) at gc.c:1077
#3  0x00000000005834bb in start_wrapper_internal (data=<value optimized out>) at threads.c:660
#4  start_wrapper (data=<value optimized out>) at threads.c:707
#5  0x0000000000633176 in inner_start_thread (arg=<value optimized out>) at mono-threads-posix.c:100
#6  0x0000003428807851 in start_thread () from /lib64/libpthread.so.0
#7  0x00000037dfee890d in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7fb007f38780 (LWP 14594)):
#0  0x000000342880f09d in waitpid () from /lib64/libpthread.so.0
#1  0x00000000004a4e08 in mono_handle_native_sigsegv (signal=<value optimized out>, ctx=<value optimized out>) at mini-exceptions.c:2323
#2  <signal handler called>
#3  0x00000037dfe328a5 in raise () from /lib64/libc.so.6
#4  0x00000037dfe34085 in abort () from /lib64/libc.so.6
#5  0x0000000000637d1d in monoeg_g_logv (log_domain=<value optimized out>, log_level=G_LOG_LEVEL_ERROR, format=<value optimized out>, args=<value optimized out>) at goutput.c:177
#6  0x0000000000637dc7 in monoeg_assertion_message (format=<value optimized out>) at goutput.c:197
#7  0x000000000042a797 in mono_spill_global_vars (cfg=<value optimized out>, need_local_opts=0x7fffc30c8198) at method-to-ir.c:13450
#8  0x000000000041cceb in mini_method_compile (method="%s:%s ()", opts=4143840767, domain=0x1d02c90, flags=<value optimized out>, parts=0) at mini.c:5624
#9  0x0000000000485c23 in compile_method (acfg=0x1d6eef0, method="%s:%s ()") at aot-compiler.c:6596
#10 0x000000000048684e in compile_methods (acfg=0x1d6eef0) at aot-compiler.c:8520
#11 0x000000000048fae5 in mono_compile_assembly (ass=<value optimized out>, opts=<value optimized out>, aot_options=<value optimized out>) at aot-compiler.c:8935
#12 0x000000000047c766 in main_thread_handler (argc=4, argv=<value optimized out>) at driver.c:1045
#13 mono_main (argc=4, argv=<value optimized out>) at driver.c:2020
#14 0x00000037dfe1ecdd in __libc_start_main () from /lib64/libc.so.6
#15 0x00000000004130d9 in _start ()

=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================
Comment 1 Zoltan Varga 2014-10-23 14:48:14 UTC
Fixed in master. -O=all doesn't really lead to faster code right now, use --llvm instead.
Comment 2 Craig Minihan 2014-10-24 15:22:21 UTC
I can't seem to build Mono 3.8 with mono/llvm/master, the error I see is:

/usr/local/include/llvm/ExecutionEngine/RuntimeDyld.h:43: warning: ‘virtual uint8_t* llvm::RTDyldMemoryManager::allocateCodeSection(uintptr_t, unsigned int, unsigned int)’ was hidden
mini-llvm-cpp.cpp:129: warning:   by ‘virtual uint8_t* MonoJITMemoryManager::allocateCodeSection(uintptr_t, unsigned int, unsigned int, llvm::StringRef)’
/usr/local/include/llvm/ExecutionEngine/RuntimeDyld.h:49: warning: ‘virtual uint8_t* llvm::RTDyldMemoryManager::allocateDataSection(uintptr_t, unsigned int, unsigned int, bool)’ was hidden
mini-llvm-cpp.cpp:136: warning:   by ‘virtual uint8_t* MonoJITMemoryManager::allocateDataSection(uintptr_t, unsigned int, unsigned int, llvm::StringRef, bool)’
mini-llvm-cpp.cpp: In function ‘void* mono_llvm_create_ee(LLVMOpaqueModuleProvider*, unsigned char* (*)(LLVMOpaqueValue*, int), void (*)(LLVMOpaqueValue*, void*, void*), void (*)(void*), char* (*)(const char*, void**), LLVMOpaqueExecutionEngine**)’:
mini-llvm-cpp.cpp:589: error: cannot allocate an object of abstract type ‘MonoJITMemoryManager’
mini-llvm-cpp.cpp:76: note:   because the following virtual functions are pure within ‘MonoJITMemoryManager’:
/usr/local/include/llvm/ExecutionEngine/RuntimeDyld.h:43: note: 	virtual uint8_t* llvm::RTDyldMemoryManager::allocateCodeSection(uintptr_t, unsigned int, unsigned int)
/usr/local/include/llvm/ExecutionEngine/RuntimeDyld.h:49: note: 	virtual uint8_t* llvm::RTDyldMemoryManager::allocateDataSection(uintptr_t, unsigned int, unsigned int, bool)
make[4]: *** [mini-llvm-cpp.lo] Error 1

Sorry but 'git log' suggests you are the man to ask!
Comment 3 Zoltan Varga 2014-10-24 15:37:26 UTC
I'd suggest using mono 3.10/master with llvm's 'mono' branch.
Comment 4 Craig Minihan 2014-10-24 19:22:28 UTC
Thanks Zoltan - I got it working with 3.8 using the mono-3-4-0 branch. I'll take a look at 3.10 later.