mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-12-22 23:29:27 +00:00
Fix mis-optimization of "expression && non-zero constant" operations with 32-bit type.
The previous code may have been intended to convert this to a "!=0" test, which would have been valid if correctly implemented, but with the current code generator that actually yields worse code than the original version, so for now I just removed the optimization for this case. This problem could lead to crashes in code like the following (derived from a csmith-generated test case): #pragma optimize 1 int main(int argc, char *argv[]){ long l_57 = argc; return (4 ^ l_57) && 6; }
This commit is contained in:
parent
db98f7842d
commit
7f94876fa8
4
DAG.pas
4
DAG.pas
@ -1569,9 +1569,7 @@ case op^.opcode of {check for optimizations of this node}
|
|||||||
end; {with}
|
end; {with}
|
||||||
opv := op^.right;
|
opv := op^.right;
|
||||||
end; {if}
|
end; {if}
|
||||||
end {if}
|
end; {if}
|
||||||
else
|
|
||||||
op^.opcode := pc_neq;
|
|
||||||
end; {if}
|
end; {if}
|
||||||
end {if}
|
end {if}
|
||||||
else if op^.left^.opcode = pc_ldc then
|
else if op^.left^.opcode = pc_ldc then
|
||||||
|
Loading…
Reference in New Issue
Block a user