On Mon, Oct 09, 2006 at 04:52:19PM +0200, Daniel Glöckner wrote:
> and I would not have inserted that bug in gen_cvt_itof by
> incorrectly using func_old_type.
Patch for this bug (and another one that I found while testing the
patch) attached. Apply after the big EABI patch.
Daniel
diff -rwud a/arm-gen.c b/arm-gen.c
--- a/arm-gen.c Mon Oct 9 17:39:55 2006
+++ b/arm-gen.c Mon Oct 9 18:15:37 2006
@@ -117,6 +117,10 @@
are directly pushed on stack. */
//#define FUNC_STRUCT_PARAM_AS_PTR
+#if defined(TCC_ARM_EABI) && defined(TCC_ARM_VFP)
+static CType float_type, double_type, func_float_type, func_double_type;
+#endif
+
/* pointer size, in bytes */
#define PTR_SIZE 4
@@ -898,7 +902,7 @@
o(0xEE000A10); /* fmsr s0,r0 */
} else {
o(0xEE000B10); /* fmdlr d0,r0 */
- o(0xEE200B10); /* fmdhr d0,r1 */
+ o(0xEE201B10); /* fmdhr d0,r1 */
}
}
#endif
@@ -1582,8 +1586,15 @@
return;
} else if(bt == VT_LLONG) {
int func;
+ CType *func_type = &func_old_type;
#ifdef TCC_ARM_VFP
+#ifdef TCC_ARM_EABI
+ func_type = &func_double_type;
+#endif
if((t & VT_BTYPE) == VT_FLOAT) {
+#ifdef TCC_ARM_EABI
+ func_type = &func_float_type;
+#endif
if(vtop->type.t & VT_UNSIGNED)
func=TOK___ulltof;
else
@@ -1594,7 +1605,7 @@
func=TOK___ulltold;
else
func=TOK___slltold;
- vpush_global_sym(&func_old_type, func);
+ vpush_global_sym(func_type, func);
vswap();
gfunc_call(1);
vpushi(0);
diff -rwud a/tcc.c b/tcc.c
--- a/tcc.c Mon Oct 9 17:39:55 2006
+++ b/tcc.c Mon Oct 9 17:41:43 2006
@@ -9281,6 +9281,16 @@
func_old_type.t = VT_FUNC;
func_old_type.ref = sym_push(SYM_FIELD, &int_type, FUNC_CDECL, FUNC_OLD);
+#if defined(TCC_ARM_EABI) && defined(TCC_ARM_VFP)
+ float_type.t = VT_FLOAT;
+ double_type.t = VT_DOUBLE;
+
+ func_float_type.t = VT_FUNC;
+ func_float_type.ref = sym_push(SYM_FIELD, &float_type, FUNC_CDECL,
FUNC_OLD);
+ func_double_type.t = VT_FUNC;
+ func_double_type.ref = sym_push(SYM_FIELD, &double_type, FUNC_CDECL,
FUNC_OLD);
+#endif
+
#if 0
/* define 'void *alloca(unsigned int)' builtin function */
{
_______________________________________________
Tinycc-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/tinycc-devel