AnyDSL / thorin

The Higher-Order Intermediate Representation
https://anydsl.github.io
GNU Lesser General Public License v3.0
151 stars 15 forks source link

Thorin segfault on unreachable code when emitting LLVM #29

Closed richardmembarth closed 6 years ago

richardmembarth commented 8 years ago

The following code segfaults when generating LLVM code due to unreachable code (llvm.cpp:321):

extern "C" {
  fn sqrtf(f32) -> f32;
}
extern
fn thorin_test() -> () {
    let check: [float * 1]; 
    let X = ~[12:float];
    let sval = sqrtf(X(0));
    if check(0) > 0f { }   
}
madmann91 commented 6 years ago

The variable check needs an initializer. If you provide one, this now works on master. I tested the program with these initializers:

I am therefore closing this issue.