Bug? Assertion `!isUnknown()' failed. Aborted (core dumped)
joeskeen opened this issue · comments
I've been working on the Advent of Code 2021 Day 16: Packet Decoder puzzle. After correcting all reported syntax errors, attempting to compile the file yields the following error:
emojicodec: ../Compiler/MemoryFlowAnalysis/MFFlowCategory.hpp:31: bool EmojicodeCompiler::MFFlowCategory::isEscaping() const: Assertion `!isUnknown()' failed.
Aborted (core dumped)
The error really doesn't point me in the right direction for figuring out where the problem is in my code. Any ideas on how to get this fixed?
Here's my code:
https://github.com/joeskeen/advent-of-code-2021/blob/master/16/solve.emojic
Yes, this is definitely a compiler bug.
Could you try to find a minimal example that reproduces the error? The easiest way to do this is by removing all code that is not necessary to produce the error. The bug is probably related to a loop or if statement, so I'd try removing other stuff first.
Here is the minimum I was able to find that reproduced the error:
🏁🍇
🍉
🐇 🏭 🍇
🐇 ❗📨 bits🍨🐚🔡🍆 startIndex🔢 🍇
🆕🥡 0 0 0 0 ❗ ➡️ packet
🍉
🍉
🐇 ✉️ 🍇
🖍️🆕packetVersion🔢
🖍️🆕packetType🔢
🖍️🆕packetLength🔢
🆕 🍼packetVersion🔢 🍼packetType🔢 🍼packetLength🔢 🍇🍉
🍉
🐇 🥡 ✉️ 🍇
🖍️🆕literalValue🔢
🆕 packetVersion🔢 packetType🔢 packetLength🔢 🍼literalValue🔢 🍇
⤴️🆕 packetVersion packetType packetLength ❗
🍉
🍉
Note that if you take line 7 🆕🥡 0 0 0 0 ❗ ➡️ packet
and move it to the 🏁 block and remove the 🏭 class, it compiles fine.
Thanks for posting a minimal example! I'll look into this later to see if there's a workaround. Fixing this bug might take longer though.
The bug is fixed on master and will be included in the next release of Emojicode. You can also workaround the issue by moving the ✉️ class above 🏭. This causes the constructor of ✉️ to be analysed (in the MF analysis) before the super-constructor call