Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Mar 2009 06:31:15 +1100
From:      Peter Jeremy <peterjeremy@optushome.com.au>
To:        Dieter <freebsd@sopwith.solgatos.com>
Cc:        freebsd-amd64@freebsd.org
Subject:   Re: 32-bit truncation of 64-bit values
Message-ID:  <20090301193115.GD3540@server.vk2pj.dyndns.org>
In-Reply-To: <200902282106.VAA17590@sopwith.solgatos.com>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
On 2009-Feb-28 13:06:41 +0000, Dieter <freebsd@sopwith.solgatos.com> wrote:
>> Having just tracked down an issue caused by a pointer-to-int truncation,
>
>Was this in C?  Didn't the compiler complain?

Yes and no.  It wasn't as obvious as your example, rather it was missing
function prototypes.  After unrolling macros, the offending code did:

int     input_line;
int     cursor = 0;
extern  void    putchar_x();
extern  char    *CM;
...
	tputs(tgoto(CM, cursor, input_line), 0, putchar_x);
...
without <curses.h>, <term.h> or other prototypes.  As a result,
tgoto() was implicitly assumed to return (int) instead of (char *) -
which doesn't produce any warning unless compiled with -Wall.

(If you want to experiment, this is ports/irc/blackened - the above
code is in source/input.c, though there seem to be several other
similar problems in the code, resulting in the current BROKEN flag).

-- 
Peter Jeremy

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (FreeBSD)

iEYEARECAAYFAkmq4oMACgkQ/opHv/APuIdcPgCguPMdUC4EJ9QHgYv0+Xjfg+Qn
zrMAnA61cLbWqsajtHw+HDsF5f5ZbZLo
=9t+/
-----END PGP SIGNATURE-----
home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090301193115.GD3540>