Fix codegen bug with pc_bno in some cases with a 64-bit right operand.

The desired location for the quad result was not saved, so it could be overwritten when generating code for the left operand. This could result in incorrect code that might trash the stack.

Here is an example affected by this:

#pragma optimize 1
int main(void) {
        long long a, b=2;
        char c = (a=1,b);
}
This commit is contained in:
Stephen Heumann 2022-06-08 20:03:14 -05:00
parent 0e8b485f8f
commit a85846cc80
1 changed files with 3 additions and 0 deletions

View File

@ -5444,11 +5444,14 @@ procedure GenTree {op: icptr};
var
lLong: longType; {requested address type}
lQuad: quadType;
begin {GenBno}
lLong := gLong;
lQuad := gQuad;
GenTree(op^.left);
gLong := lLong;
gQuad := lQuad;
GenTree(op^.right);
end; {GenBno}