mirror of
https://github.com/cc65/cc65.git
synced 2024-09-27 19:55:09 +00:00
fix int const - float var
This commit is contained in:
parent
fee2b834b0
commit
a8e9783f1c
@ -94,7 +94,7 @@ NOT WORKING YET:
|
|||||||
|
|
||||||
/test/val/float-basic-intvar-const.c -, +=, -=, *=, /=
|
/test/val/float-basic-intvar-const.c -, +=, -=, *=, /=
|
||||||
/test/val/float-basic-intvar-var.c -, *, /, +=, /=
|
/test/val/float-basic-intvar-var.c -, *, /, +=, /=
|
||||||
/test/val/float-basic-intconst-var.c -, *, /
|
/test/val/float-basic-intconst-var.c *, /
|
||||||
|
|
||||||
/test/val/float-cmp-const-intvar.c
|
/test/val/float-cmp-const-intvar.c
|
||||||
/test/val/float-cmp-intvar-const.c
|
/test/val/float-cmp-intvar-const.c
|
||||||
|
@ -4018,14 +4018,14 @@ static void parsesub (ExprDesc* Expr)
|
|||||||
} else if (IsClassFloat (lhst) && IsClassFloat (rhst)) {
|
} else if (IsClassFloat (lhst) && IsClassFloat (rhst)) {
|
||||||
/* Float substraction */
|
/* Float substraction */
|
||||||
/* FIXME: float - what to do here exactly? */
|
/* FIXME: float - what to do here exactly? */
|
||||||
LOG(("%s:%d parsesub float - float\n", __FILE__, __LINE__));
|
LOG(("%s:%d parsesub float - float var\n", __FILE__, __LINE__));
|
||||||
/* Adjust operand types */
|
/* Adjust operand types */
|
||||||
/*flags = typeadjust (Expr, &Expr2, 0);*/
|
/*flags = typeadjust (Expr, &Expr2, 0);*/
|
||||||
flags = CF_FLOAT;
|
flags = CF_FLOAT;
|
||||||
} else if (IsClassFloat (lhst) && IsClassInt (rhst)) {
|
} else if (IsClassFloat (lhst) && IsClassInt (rhst)) {
|
||||||
/* Float substraction */
|
/* Float substraction */
|
||||||
/* FIXME: float - what to do here exactly? */
|
/* FIXME: float - what to do here exactly? */
|
||||||
LOG(("%s:%d parsesub float - int\n", __FILE__, __LINE__));
|
LOG(("%s:%d parsesub float - int var\n", __FILE__, __LINE__));
|
||||||
#if 1
|
#if 1
|
||||||
/* Adjust operand types */
|
/* Adjust operand types */
|
||||||
flags = typeadjust (Expr, &Expr2, 0);
|
flags = typeadjust (Expr, &Expr2, 0);
|
||||||
@ -4034,12 +4034,15 @@ static void parsesub (ExprDesc* Expr)
|
|||||||
} else if (IsClassInt (lhst) && IsClassFloat (rhst)) {
|
} else if (IsClassInt (lhst) && IsClassFloat (rhst)) {
|
||||||
/* Float substraction */
|
/* Float substraction */
|
||||||
/* FIXME: float - what to do here exactly? */
|
/* FIXME: float - what to do here exactly? */
|
||||||
LOG(("FIXME: %s:%d parsesub int - float\n", __FILE__, __LINE__));
|
LOG(("FIXME: %s:%d parsesub int - float var\n", __FILE__, __LINE__));
|
||||||
#if 0
|
#if 1
|
||||||
/* Adjust operand types */
|
/* Remove pushed value from stack */
|
||||||
/*flags = typeadjust (Expr, &Expr2, 0);*/
|
RemoveCode (&Mark2);
|
||||||
flags = CF_FLOAT;
|
flags = typeadjust (&Expr2, Expr, 0);
|
||||||
|
g_push (CF_FLOAT, 0); /* --> stack */
|
||||||
|
LoadExpr (CF_FLOAT, &Expr2); /* --> primary register */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* OOPS */
|
/* OOPS */
|
||||||
Error ("Invalid operands for binary operator '-'");
|
Error ("Invalid operands for binary operator '-'");
|
||||||
@ -4052,8 +4055,12 @@ static void parsesub (ExprDesc* Expr)
|
|||||||
ED_FinalizeRValLoad (Expr);
|
ED_FinalizeRValLoad (Expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Result type is either a pointer or an integer */
|
if (IsClassFloat (lhst) || IsClassFloat (rhst)) {
|
||||||
Expr->Type = StdConversion (Expr->Type);
|
Expr->Type = type_float;
|
||||||
|
} else {
|
||||||
|
/* Result type is either a pointer or an integer */
|
||||||
|
Expr->Type = StdConversion (Expr->Type);
|
||||||
|
}
|
||||||
|
|
||||||
/* Condition code not set */
|
/* Condition code not set */
|
||||||
ED_MarkAsUntested (Expr);
|
ED_MarkAsUntested (Expr);
|
||||||
|
@ -83,11 +83,11 @@ void intconstvar(void)
|
|||||||
printf("fp1:0x%08lx [?] %s (58.123)", *((uint32_t*)&fp1), _ftostr(buf, fp1));
|
printf("fp1:0x%08lx [?] %s (58.123)", *((uint32_t*)&fp1), _ftostr(buf, fp1));
|
||||||
test1(fp1, "42687df4");
|
test1(fp1, "42687df4");
|
||||||
|
|
||||||
#if 0 // Invalid operands for binary operator '-'
|
|
||||||
fp1 = 47 - var_float;
|
fp1 = 47 - var_float;
|
||||||
printf("fp1:0x%08lx [?] %s (58.123)", *((uint32_t*)&fp1), _ftostr(buf, fp1));
|
printf("fp1:0x%08lx [?] %s (35.877)", *((uint32_t*)&fp1), _ftostr(buf, fp1));
|
||||||
test1(fp1, "42687df4");
|
test1(fp1, "420f820c");
|
||||||
#endif
|
|
||||||
#if 0 // compiles, but wrong result
|
#if 0 // compiles, but wrong result
|
||||||
fp1 = 47 * var_float;
|
fp1 = 47 * var_float;
|
||||||
printf("fp1:0x%08lx [?] %s (522.781)", *((uint32_t*)&fp1), _ftostr(buf, fp1));
|
printf("fp1:0x%08lx [?] %s (522.781)", *((uint32_t*)&fp1), _ftostr(buf, fp1));
|
||||||
|
Loading…
Reference in New Issue
Block a user