fix Issue 13152 - Compiler high cpu usage and never ends

Partially revert "Merge pull request #2448 from hpohl/10752"
Merge pull request #3790 from 9rnsr/fix13152

[REG2.064] Issue 13152 - Compiler high cpu usage and never ends