Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix segfault when code_llvm or code_native are called on a C function #8239

Merged
merged 2 commits into from
Sep 5, 2014
Merged

Fix segfault when code_llvm or code_native are called on a C function #8239

merged 2 commits into from
Sep 5, 2014

Conversation

danluu
Copy link
Contributor

@danluu danluu commented Sep 4, 2014

Code that segfaults on current master includes any of the following, and other similar things:

 code_llvm(match,(Regex,String))
 code_native(match,(Regex,String))
 code_llvm(*,(Array{Int}, Array{Int}))
 code_native(*,(Array{Int}, Array{Int}))

Backtrace looks something like:

# Program received signal SIGSEGV, Segmentation fault.                                                                            
# 0x00007ffff6d9f424 in emit_function (lam=0x1c7fcf0, cstyle=true) at codegen.cpp:3445                                            
#3445            for(size_t i=0; i < jl_tuple_len(lam->specTypes); i++) {                                                        
# (gdb) bt                                                                                                                        
# #0  0x00007ffff6d9f424 in emit_function (lam=0x1c7fcf0, cstyle=true) at codegen.cpp:3445                                        
# #1  0x00007ffff6d7cd2f in to_function (li=0x1c7fcf0, cstyle=true) at codegen.cpp:570                                            
# #2  0x00007ffff6d7d253 in jl_cstyle_compile (f=0x1c6e780) at codegen.cpp:698                                                    
# #3  0x00007ffff6d803c7 in jl_get_llvmf (f=0x1c6e6a0, types=0x2b4b300, getwrapper=false)                                         
#     at codegen.cpp:870                                                                                                          
# #4  0x00007ffff6d80492 in jl_dump_function (f=0x1c6e6a0, types=0x2b4b300, dumpasm=true,                                         
#     dumpwrapper=false) at codegen.cpp:888                                                                                       
# #5  0x00007ffff4aa8f77 in ?? ()                                                                                                 
# #6  0x0000000000000006 in ?? ()                                                                                                 
# #7  0x00007fffffffcd40 in ?? ()                                                                                                 
# #8  0x0000000000000000 in ?? ()                                                                                                 

The current 0.3 RC (.3.1-pre+42) seems immune to this bug.

@Keno
Copy link
Member

Keno commented Sep 4, 2014

I'll see if I can come up with a better fix for this that preserves the behavior I was trying to get. Maybe just check for specTypes in get_llvmf?

@danluu
Copy link
Contributor Author

danluu commented Sep 4, 2014

@Keno Like this? Not sure what the behavior you were trying to get was, though.

@Keno
Copy link
Member

Keno commented Sep 4, 2014

Yeah, if that works, that looks good to me.

JeffBezanson added a commit that referenced this pull request Sep 5, 2014
Fix segfault when code_llvm or code_native are called on a C function
@JeffBezanson JeffBezanson merged commit 6277015 into JuliaLang:master Sep 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants