-
-
Notifications
You must be signed in to change notification settings - Fork 313
Open
Labels
BugSomething isn't workingSomething isn't workingFixed needs testingNeeds verification / testing that it now worksNeeds verification / testing that it now works
Description
I was testing a completely unrelated issue and happened to catch this error in the process.
⚠️ The compiler encountered an unexpected error: "Violated assert: context->current_block".
- Function: llvm_emit_cond_br(...)
- Source file: ../src/compiler/llvm_codegen_instr.c:16
🙏 Please consider taking the time to file an issue on GitHub (https://github.com/c3lang/c3c/issues/new), so that we can get it fixed.
Repro:
module testing_branch;
import std::io;
faultdef OH_NO;
const C = 1;
fn void main() => do_thing()!!;
fn void? do_thing()
{
int* a_value = mem::alloc_array(int, 4);
// Change 'C' below to any integer value and the assert goes away.
*(int128*)a_value = may_fault(int128, "-123", C)!;
io::printfn("Value: %d", *a_value);
}
macro may_fault($ArgType, something, $incoming)
{
$switch $incoming:
$case 1: return OH_NO?;
$default: return something.to_integer($ArgType);
$endswitch
}Metadata
Metadata
Assignees
Labels
BugSomething isn't workingSomething isn't workingFixed needs testingNeeds verification / testing that it now worksNeeds verification / testing that it now works