Merge pull request #3790 from 9rnsr/fix13152

[REG2.064] Issue 13152 - Compiler high cpu usage and never ends
Merge pull request #3792 from AndrewEdwards/2.066

Merge pull request #3790 from 9rnsr/fix13152