mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-12-28 16:30:59 +00:00
Avoid errors from attempting common subexpression elimination on the left subexpression of the comma operator.
This could happen because the left subexpression does not produce a result for use in the enclosing expression, and therefore is not of the form expected by the CSE code. The following program (derived from a csmith-generated test case) illustrates the problem: #pragma optimize 16 int main(void) { int i; i, (i, 1); }
This commit is contained in:
parent
fd0ff033ad
commit
a9f7f97a2f
6
DAG.pas
6
DAG.pas
@ -2648,7 +2648,8 @@ var
|
||||
begin {Match}
|
||||
op2 := nil; {check for an exact match}
|
||||
skip := false;
|
||||
if CodesMatch(op, tree, true) then begin
|
||||
if not (op^.opcode in [pc_str,pc_sro]) and CodesMatch(op, tree, true)
|
||||
then begin
|
||||
if op = tree then
|
||||
op2 := tree
|
||||
else begin
|
||||
@ -2698,7 +2699,8 @@ var
|
||||
if op^.right <> nil then
|
||||
CheckTree(op^.right, bb);
|
||||
if op^.next = nil then {look for a match to the current code}
|
||||
if not (op^.opcode in [pc_cup,pc_cui,pc_tl1,pc_bno]) then begin
|
||||
if not (op^.opcode in [pc_cup,pc_cui,pc_tl1,pc_bno,pc_pop,pc_sto,pc_sbf])
|
||||
then begin
|
||||
op2 := nil;
|
||||
op3 := bb^.code;
|
||||
while (op2 = nil) and (op3 <> nil) do begin
|
||||
|
Loading…
Reference in New Issue
Block a user