bfc hangs due to compile-time evaluation
I am trying to compile the following code with bfc -O2:
. + [[ [[ >. [+ [<>]]] >]<>+ .]>< ,-.,,+++[]---]
But it shows warning:
24852.bf:1:26 warning: This instruction moves the pointer after the last cell (99999), to cell 100000.
. + [[ [[ >. [+ [<>]]] >]<>+ .]>< ,-.,,+++[]---]
^
But no exit. It should fall into some infinite loop or similar things.
Another similar problem is also found when compiling:
-[+ >>>.><-[--<]-->.+.--],[><--[.]-]- [] >>- <-,>,
it shows the warning but the compilation is not stopping.
This looks like an issue where we aggressively unroll the loop due to compile-time evaluation, send a huge amount of IR to LLVM, and then it spends ages trying to optimise the IR.
I've added an undocumented BFC_MAX_STEPS which limits the execution steps and thus the LLVM IR size. Nonetheless, execution steps are still fast, it's the IR munging afterwards that's taking the time.
Possibly related: #26.
Since the issue is addressed by the owner. I will close this thread.
I think this a genuine bug worth fixing, so I'm going to reopen this :)