Re: [cc65] Adding ints and longs

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2002-07-10 23:03:16


Hi!

On Wed, Jul 10, 2002 at 08:25:28PM +0200, Maciej Witkowiak wrote:
> When trying to write NTP client for 6502 (where problem lays in converting
> 32-bit seconds to h:m,d/m/year format) I tried to use parts of glibc and
> encountered this problem:
[...]

Thanks for the report! This is a bug and it points out a place where a
function is more or less abused for a purpose it was not thought for. Here is
a patch that may be used as a workaround, I will implement a better solution
in the development version:

------------------------------------------------------------------------------
Index: src/cc65/expr.c
===================================================================
RCS file: /usr/local/cvsroot/uz/c64/cc65/src/cc65/expr.c,v
retrieving revision 1.55.2.2
diff -c -r1.55.2.2 expr.c
*** src/cc65/expr.c	26 May 2002 11:07:59 -0000	1.55.2.2
--- src/cc65/expr.c	10 Jul 2002 20:57:49 -0000
***************
*** 2947,2954 ****
      lflags |= TypeOf (lval->Type) | CF_FORCECHAR;
      rflags |= TypeOf (lval2.Type);

!     /* Adjust the rhs to the lhs */
!     g_typeadjust (lflags, rflags);

      /* Output apropriate code */
      if (lval->Flags & E_MGLOBAL) {
--- 2947,2956 ----
      lflags |= TypeOf (lval->Type) | CF_FORCECHAR;
      rflags |= TypeOf (lval2.Type);

!     /* Adjust the rhs to the lhs. To avoid manipulation of the TOS, mark
!      * the lhs as const.
!      */
!     g_typeadjust (lflags | CF_CONST, rflags);

      /* Output apropriate code */
      if (lval->Flags & E_MGLOBAL) {
------------------------------------------------------------------------------

> And the second thing - ld65 still reports its version as 2.4.0, it is probably
> it still has own version.h in src/ld65 directory.

Correct, there is an obsolete version.h file in the ld65 directory. I will fix
it - thanks for the hint!

Regards


	Uz


-- 
Ullrich von Bassewitz                                  uz_at_musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2002-07-10 23:03:29 CEST