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;
|
||||
opv := op^.left;
|
||||
end; {if}
|
||||
if totype.optype in [cgReal,cgDouble,cgExtended,cgComp] then
|
||||
if (totype.optype = op^.left^.optype) or
|
||||
(totype.optype = cgExtended) or
|
||||
((totype.optype = cgDouble) and (op^.left^.optype = cgReal)) then
|
||||
opv := op^.left;
|
||||
if fromtype.optype in [cgReal,cgDouble,cgExtended,cgComp] then
|
||||
if totype.optype in [cgReal,cgDouble,cgExtended,cgComp] then
|
||||
if (totype.optype = op^.left^.optype) or
|
||||
(totype.optype = cgExtended) or
|
||||
((totype.optype = cgDouble) and (op^.left^.optype = cgReal)) then
|
||||
opv := op^.left;
|
||||
end {else if}
|
||||
else if op^.q in [$40,$41,$50,$51] then begin
|
||||
{any long type to byte type}
|
||||
|
|
Loading…
Reference in New Issue