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:
Stephen Heumann 2021-09-03 21:08:27 -05:00
parent da6898214f
commit beb0d010c2

View File

@ -1430,6 +1430,7 @@ case op^.opcode of {check for optimizations of this node}
op^.left^.optype := totype.optype;
opv := op^.left;
end; {if}
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