Open gabrieldemarmiesse opened 1 month ago
This internally hits an LLVM assert:
Assertion failed: (Iter != this->end() && "DenseMap::at failed due to a missing key"), function at, file DenseMap.h, line 213.
It's coming from M::KGEN::Elaborator::lookupConcreteFunction
FYI @Mogball
debug_assert is playing with fire with its dependencies on String. This likely is another case of a crash instead of an error message
While we do have enabled all assertions in the CI, it's not enabled for test_string.mojo
and as such, when the bug is resolved, we should not forget to enable assertions there too.
Bug description
This bug is a blocker for https://github.com/modularml/mojo/issues/2687
When compiling
test_string.mojo
with-D MOJO_ENABLE_ASSERTIONS
I noticed that I got some flaky segfaults.It's reproducible in the CI as you can see here: https://github.com/modularml/mojo/actions/runs/9139790714/job/25132482734?pr=2718#step:9:86
But I also tried to make a minimal reproducible example. It's hard as the more code is removed, the more likely it is that the build will succeeds.
Here is the type of output I get:
Steps to reproduce
Use nightly. Download the following gist and put it in a file: https://gist.github.com/gabrieldemarmiesse/bdbb73ba9672c071a99e6f13abe1e8e4
Then run the following command (possibly multiple times since it's flaky):
It's important to delete the cache before every compilation as when the build succeeds, then the cache will be used and the segfault will not appear again.
On my computers (I tested with two of them) I have a 50% failure rate. The CI can reproduce the error too.
If you want a higher failure rate, intead of copying my gist, copy the content of this file: https://github.com/modularml/mojo/blob/826b2bd2cb9fa27258cce9245d0d50824de12e18/stdlib/test/builtin/test_string.mojo
When I compile this file, I have a failure rate of 90%.
System information