Coercion from int to float is now always done compile time

This commit is contained in:
ceriel
1988-10-03 10:09:19 +00:00
parent 4cecb6bffb
commit 6b7a135b2b
3 changed files with 25 additions and 3 deletions

View File

@@ -504,6 +504,13 @@ check_ival(expp, tp)
#endif DEBUG
if (expr->ex_class == Float)
C_con_fcon(expr->FL_VALUE, expr->ex_type->tp_size);
#ifdef NOTDEF
Coercion from int to float is now always done compile time.
This, to accept declarations like
double x = -(double)1;
and also to prevent runtime coercions for compile-time constants.
else
if (expr->ex_class == Oper && expr->OP_OPER == INT2FLOAT) {
/* float f = 1; */
@@ -514,6 +521,7 @@ check_ival(expp, tp)
else
illegal_init_cst(expr);
}
#endif NOTDEF
else
illegal_init_cst(expr);
break;