grame-cncm / faust

Functional programming language for signal processing and sound synthesis
http://faust.grame.fr
Other
2.53k stars 319 forks source link

faust2 segfaults with LLVM 3.5 #15

Closed agraef closed 7 years ago

agraef commented 7 years ago

faust2 compiled with LLVM 3.5 on Arch Linux. Here's what I get if I try to compile examples/reverb/freeverb.dsp to bitcode:

$ faust -double -lang llvm freeverb.dsp -o freeverb.bc
Segmentation fault (core dumped)

gdb backtrace:

#0  0x000000000058f986 in llvm::DataLayout::isLittleEndian (this=0x0)
    at /usr/include/llvm/IR/DataLayout.h:209
#1  llvm::DataLayout::operator= (DL=..., this=0x1b17d70)
    at /usr/include/llvm/IR/DataLayout.h:191
#2  llvm::DataLayout::DataLayout (DL=..., this=0x1b17d70)
    at /usr/include/llvm/IR/DataLayout.h:187
#3  LLVMTypeInstVisitor::LLVMTypeInstVisitor (prefix=..., 
    module=<optimized out>, 
    __vtt_parm=0x947ff0 <VTT for LLVMTypeInstVisitor1+8>, this=0x7fffffffdb50, 
    __in_chrg=<optimized out>) at generator/llvm/llvm_instructions.hh:586
#4  LLVMTypeInstVisitor1::LLVMTypeInstVisitor1 (prefix=..., 
    module=<optimized out>, this=0x7fffffffdb50, __in_chrg=<optimized out>, 
    __vtt_parm=<optimized out>) at generator/llvm/llvm_instructions.hh:766
#5  LLVMCodeContainer::produceFactory (this=0x199f1f0)
    at generator/llvm/llvm_code_container.cpp:721
#6  0x000000000067dab3 in generateCode (generate=true, 
    numOutputs=<optimized out>, numInputs=<optimized out>, 
    signals=0x7fffec5d77f0, this=<optimized out>) at libcode.cpp:974
#7  compile_faust_internal (argc=argc@entry=7, argv=argv@entry=0x7fffffffe7b8, 
    name=name@entry=0x6bdec2 "FaustDSP", dsp_content=dsp_content@entry=0x0, 
    generate=generate@entry=true) at libcode.cpp:1188
#8  0x000000000067ef81 in compile_faust_factory (argc=7, argv=0x7fffffffe7b8, 
    name=name@entry=0x6bdec2 "FaustDSP", dsp_content=dsp_content@entry=0x0, 
    error_msg="", generate=generate@entry=true) at libcode.cpp:1205
#9  0x0000000000674aa9 in main (argc=<optimized out>, argv=<optimized out>)
    at main.cpp:35

This example still works with LLVM 3.5 using an old snapshot (rev. 33009c4) of faust2 from sf2 git, so this is most likely a regression that recently got introduced with all the latest changes.

Note that the latest faust2 also compiles this file ok when using LLVM 3.9. But for compatibility with Pure I really need this to work with LLVM 3.5 as well. Pure is still stuck at this version right now, since LLVM 3.5 is the last version that still has the old (non-MC) JIT.

sletz commented 7 years ago

Fixed in 4fb987c9b6526d0e6bd43be0a3cbe29707eeac47.