Backport: Revert assertions in compiler spec to strict array equality
Backport: Localise variables for readability, since they were only used in one place
Merge pull request #1126 from Sinjo/backport_assertion_fixes_to_1_7

Backport assertion fixes to 1.7 branch