mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-06-03 07:29:43 +00:00
Do not optimize away integer to floating point conversions.
This was a bug introduced in commit c95d8d9f9b
.
Here is an example of an affected program:
#pragma optimize 1
#include <stdio.h>
int main(void) {
int i = 123;
double d = i;
printf("%f\n", d);
}
This commit is contained in:
parent
da6898214f
commit
beb0d010c2
11
DAG.pas
11
DAG.pas
|
@ -1430,11 +1430,12 @@ case op^.opcode of {check for optimizations of this node}
|
||||||
op^.left^.optype := totype.optype;
|
op^.left^.optype := totype.optype;
|
||||||
opv := op^.left;
|
opv := op^.left;
|
||||||
end; {if}
|
end; {if}
|
||||||
if totype.optype in [cgReal,cgDouble,cgExtended,cgComp] then
|
if fromtype.optype in [cgReal,cgDouble,cgExtended,cgComp] then
|
||||||
if (totype.optype = op^.left^.optype) or
|
if totype.optype in [cgReal,cgDouble,cgExtended,cgComp] then
|
||||||
(totype.optype = cgExtended) or
|
if (totype.optype = op^.left^.optype) or
|
||||||
((totype.optype = cgDouble) and (op^.left^.optype = cgReal)) then
|
(totype.optype = cgExtended) or
|
||||||
opv := op^.left;
|
((totype.optype = cgDouble) and (op^.left^.optype = cgReal)) then
|
||||||
|
opv := op^.left;
|
||||||
end {else if}
|
end {else if}
|
||||||
else if op^.q in [$40,$41,$50,$51] then begin
|
else if op^.q in [$40,$41,$50,$51] then begin
|
||||||
{any long type to byte type}
|
{any long type to byte type}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user