Fix error that could happen when a function call was used in a comparison expression.

This resulted from the addition of the signed-to-unsigned comparison optimization. Specifically, it calls TypeOf for the expressions on each side of the comparison, and this did not handle function calls. That support has now been added, and will give the proper return type for direct and indirect calls to C functions. The IR for tool calls doesn't include the return type (just the number of bytes), so we return cgVoid for them. This is OK for the present use case.
This commit is contained in:
Stephen Heumann 2016-10-03 18:50:37 -05:00
parent e00d47aaaf
commit 0e82755334
1 changed files with 4 additions and 1 deletions

View File

@ -2193,7 +2193,7 @@ case op^.opcode of
pc_gil, pc_gli, pc_gdl, pc_gld, pc_iil, pc_ili, pc_idl, pc_ild,
pc_ldc, pc_ldo, pc_lil, pc_lli, pc_ldl, pc_lld, pc_lod, pc_dec,
pc_inc, pc_ind, pc_lbf, pc_lbu, pc_cop, pc_cbf, pc_cpi, pc_cpo,
pc_tri:
pc_tri, pc_cup, pc_cui:
TypeOf := op^.optype;
pc_lad, pc_lao, pc_lca, pc_lda, pc_psh, pc_ixa:
@ -2226,6 +2226,9 @@ case op^.opcode of
pc_bno:
TypeOf := TypeOf(op^.right);
pc_tl1: {pc_tl1 doesn't have type info.}
TypeOf := cgVoid; {Just return cgVoid for now.}
otherwise: Error(cge1);
end; {case}
end; {TypeOf}