AnyDSL / artic

The AlteRnaTive Impala Compiler
MIT License
25 stars 6 forks source link

self-referential struct crashes compiler #13

Closed michael-kenzel closed 2 years ago

michael-kenzel commented 2 years ago

the following code will reproduce the issue (segfault) when compiled with --emit-llvm:

#[import(cc = "thorin")]
fn cuda(i32, (i32, i32, i32), (i32, i32, i32), fn () -> ()) -> ();

struct Queue {
  next: &mut Queue,
  size: i32
}

#[export]
fn test() {
  let queue = 42 as &mut addrspace(1) Queue;

  cuda(0, (1, 1, 1), (1, 1, 1), @|| {
    queue.size = 0;
  });
}
Hugobros3 commented 2 years ago

I messed that up when merging the HLS branch. I pushed a hotfix: https://github.com/AnyDSL/thorin/commit/070da6b84a53a94336344c553190df80c5603c74

michael-kenzel commented 2 years ago

yeah that seems to do the trick, thanks!