mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-08-15 07:27:27 +00:00
Fix optimizer bug where casts with unused results could sometimes cause stack corruption.
This problem could lead to crashes in code like the following (derived from a csmith-generated test case): #pragma optimize 1 static int main(void) { long i = 2; (long)(i > 1); }
This commit is contained in:
5
DAG.pas
5
DAG.pas
@@ -1840,8 +1840,11 @@ case op^.opcode of {check for optimizations of this node}
|
||||
end; {case pc_not}
|
||||
|
||||
pc_pop: begin {pc_pop}
|
||||
if op^.left^.opcode = pc_cnv then
|
||||
if op^.left^.opcode = pc_cnv then begin
|
||||
fromtype.i := (op^.left^.q & $00F0) >> 4;
|
||||
op^.optype := fromtype.optype;
|
||||
op^.left := op^.left^.left;
|
||||
end; {if}
|
||||
opcode := op^.left^.opcode;
|
||||
if opcode = pc_cop then begin
|
||||
op^.left^.opcode := pc_str;
|
||||
|
Reference in New Issue
Block a user