mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-12-22 07:30:54 +00:00
Ensure % with negative operands is not mis-optimized in intermediate code.
This will not be triggered in most cases, but might be if one of the operand expressions was itself subject to optimization.
This commit is contained in:
parent
fedd275395
commit
80b96c1147
4
DAG.pas
4
DAG.pas
@ -1625,7 +1625,7 @@ case op^.opcode of {check for optimizations of this node}
|
||||
pc_mdl: begin {pc_mdl}
|
||||
if op^.right^.opcode = pc_ldc then
|
||||
if op^.left^.opcode = pc_ldc then
|
||||
if op^.right^.lval <> 0 then begin
|
||||
if (op^.left^.lval >= 0) and (op^.right^.lval > 0) then begin
|
||||
op^.left^.lval := op^.left^.lval mod op^.right^.lval;
|
||||
opv := op^.left;
|
||||
end; {if}
|
||||
@ -1634,7 +1634,7 @@ case op^.opcode of {check for optimizations of this node}
|
||||
pc_mod: begin {pc_mod}
|
||||
if op^.right^.opcode = pc_ldc then
|
||||
if op^.left^.opcode = pc_ldc then
|
||||
if op^.right^.q <> 0 then begin
|
||||
if (op^.left^.q >= 0) and (op^.right^.q > 0) then begin
|
||||
op^.left^.q := op^.left^.q mod op^.right^.q;
|
||||
opv := op^.left;
|
||||
end; {if}
|
||||
|
Loading…
Reference in New Issue
Block a user