Skip to content

[x86] Bug fix where an assembly entry was assumed to be an instruction and not actually checked

Summary

This merge request is in a similar vein to !228 (merged).

In the x86 peephole optimizer, a tai object returned by the GetNextInstructionUsingRegTrackingUse function was assumed to be an instruction (and hence typecast to a taicpu object) even though, under -O2 and below, it may be something else (such as a label) due to its limited search range. When the compiler was built under -CriotR rules, this could cause an 'invalid typecast' exception, and would be potentially unpredictable otherwise. This merge request fixes this problem with a single extra line of code (see the Changes tab).

System

  • Processor architecture: i386, x86_64

What is the current bug behavior?

In rare situations (was triggered by changes in !110), the compiler will crash with an "invalid typecast" error when built with -CriotR rules, and may behave unpredictably otherwise.

What is the behavior after applying this patch?

The oversight has been addressed and the compiler will no longer crash under -CriotR rules.

Edited by J. Gareth "Kit" Moreton

Merge request reports