diku-dk / futhark

:boom::computer::boom: A data-parallel functional programming language
http://futhark-lang.org
ISC License
2.4k stars 167 forks source link

Internal compiler error #1263

Closed erikvonb closed 3 years ago

erikvonb commented 3 years ago

I get the error message

Internal compiler error (unhandled IO exception).
Please report this at https://github.com/diku-dk/futhark/issues
BinderT.lookupType: unknown variable d₁₅_3968
CallStack (from HasCallStack):
  error, called at src/Futhark/Binder.hs:111:18 in futhark-0.19.1-EoNWwb8GxbcHxXBSeOeRic:Futhark.Binder

when trying to compile the code

type~ csc_mat =
  { col_offsets: []i64
  , row_idxs: []i32
  }

let reduce_state (m_init: csc_mat): csc_mat =
  (.1) <| loop (converged, s) = (false, m_init) while !converged do
    let new_matrix = { col_offsets = [], row_idxs = [] }
    in (true, new_matrix)

entry reduce_matrix: ([]i64, []i32) =
  let s = reduce_state { col_offsets = [], row_idxs = [] }
  in (s.col_offsets, s.row_idxs)

although the repl can interpret the code fine. Using futhark version 0.19.1.

athas commented 3 years ago

Looks like an oversight in lambda lifting. Should be easy to fix. Thanks for the report.

athas commented 3 years ago

Actually, this is probably an oversight in the type checker. I suspect this should violate the causality restriction (it'll work if you write it with |> instead).