mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-06-13 11:29:30 +00:00
Fix optimizer bug where tests of long or floating-point constants can trash the stack.
This problem could lead to crashes in code like the following (derived from a csmith-generated test case): #pragma optimize 1 int main (void) { if (1L) ; }
This commit is contained in:
parent
f2d15b8fc7
commit
21493271b9
2
DAG.pas
2
DAG.pas
|
@ -1327,6 +1327,7 @@ case op^.opcode of {check for optimizations of this node}
|
||||||
op^.right := nil;
|
op^.right := nil;
|
||||||
end;
|
end;
|
||||||
end; {case}
|
end; {case}
|
||||||
|
op^.optype := cgWord;
|
||||||
end {if}
|
end {if}
|
||||||
else if op^.right^.optype in [cgByte, cgUByte, cgWord, cgUWord] then begin
|
else if op^.right^.optype in [cgByte, cgUByte, cgWord, cgUWord] then begin
|
||||||
if op^.right^.q = 1 then
|
if op^.right^.q = 1 then
|
||||||
|
@ -1755,6 +1756,7 @@ case op^.opcode of {check for optimizations of this node}
|
||||||
op^.right := nil;
|
op^.right := nil;
|
||||||
end;
|
end;
|
||||||
end; {case}
|
end; {case}
|
||||||
|
op^.optype := cgWord;
|
||||||
end {if}
|
end {if}
|
||||||
else if op^.right^.optype in [cgByte, cgUByte, cgWord, cgUWord] then begin
|
else if op^.right^.optype in [cgByte, cgUByte, cgWord, cgUWord] then begin
|
||||||
if op^.right^.q = 0 then
|
if op^.right^.q = 0 then
|
||||||
|
|
Loading…
Reference in New Issue
Block a user