Open johnsoez4 opened 2 weeks ago
No problem (confirmed OK on 2024-05-28)
Problem confirmed:
@ematejska @jopamer also asked on discord at https://discord.com/channels/1087530497313357884/1224434323193594059/1242260289060077589
@ematejska, @JoeLoser , @mzaks, @jopamer, @rd4com, @jdiggins
Here's an interesting clue to the mystery. It works when the line while app_run:
is changed to while not not app_run:
.
fn app_run():
# This does not compile (seg fault).
var app_run = True
var loops = 10
while not not app_run: # This works.
# while app_run: # This does not work.
loops -= 1
if loops == 0:
app_run = False
print("app_run: Success!")
This is a compiler bug from one of our passes. It's hitting an assertion in our compiler stack inside LLVM:
Assertion failed: (detail::isPresent(Val) && "dyn_cast on a non-existent value"), function dyn_cast, file Casting.h, line 662.FYI
FYI @jeff
Thanks for filing! We'll take a look.
Duplicate filed here: https://github.com/modularml/mojo/issues/2821
Reduced use-case from there:
fn main():
var loop = True
while loop:
loop=False
Bug description
This issue started a few days ago with Mojo nightly version 2024.5.1002. Edit 2024-05-28:
In the code shown below, function
app_run
causes a seg fault, butapp_close
alone compiles and works properly. The logic to exit each while loop is essentially identical but inverted. I presume that both functions should compile and work properly. Important: I just confirmed that this issue does NOT exist with Mojo stable version 24.3.0 (9882e19d). stack_dump.txtSteps to reproduce
System information