Skip to content

[i386 / Bug Fix] Peephole Optimizer infinite loop fix

Summary

This merge request fixes a major bug where the peephole optimizer could enter an infinite loop and possibly trigger an "out of memory" error when attempting to build programs for the 386, 486 and Pentium processors. This problem has been present for at least 3 years.

The cause was due to the var13. var14 and var15 optimisations that would set Result to true even if no changes were actually made, causing the compiler to check the same optimisation over and over again. These optimisations don't trigger on the Pentium II (default option) and above because IsMOVZXAcceptable would always return True.

System

  • Processor architecture: i386

What is the current bug behavior?

When building programs, and the compiler, with -Op80386, -Op80486 or -OpPENTIUM, the peephole optimizer could enter an infinite loop.

What is the behavior after applying this patch?

Such programs and the compiler should now build successfully.

Merge request reports

Loading