Open
Description
The following program:
effect fail(): Nothing
def f(): Char / fail = do fail()
def main(): Unit =
try {
println(show(f()))
} with fail {
()
}
crashes when compiled with --backend=llvm
with the message:
opt-18: ./out/repro.ll:943:9: error: multiple definition of local value named 'v_r_4083'
%v_r_4083 = load i64, ptr %v_r_4083_pointer_19, !noalias !22, !alias.scope !12
^
[error] java.lang.RuntimeException: Nonzero exit value: 1
Indeed the resulting core program after optimzation is:
def main_3590() = reset { {p_4081} =>
val v_r_4083: Char_401 = shift(p_4081) { {k_4110} =>
return ()
};
let tmp_4109 = show_25(v_r_4083)
let tmp_4108 = println_1(tmp_4109)
return tmp_4108
}
Here we should perform some unboxing of the result of the shift
statement. The bug persists when we change the return type of f
from Char
to Int
for example.
Moreover, when this is fixed, there should be another bug revealed. We are missing a case for TChar
here: https://github.com/effekt-lang/effekt/blob/master/effekt/shared/src/main/scala/effekt/core/PolymorphismBoxing.scala#L473