Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Oct 2001 22:26:18 -0800
From:      Peter Wemm <peter@wemm.org>
To:        Mike Smith <msmith@FreeBSD.ORG>
Cc:        John Baldwin <jhb@FreeBSD.ORG>, arch@FreeBSD.ORG
Subject:   Re: time_t not to change size on x86 
Message-ID:  <20011029062618.396303808@overcee.netplex.com.au>
In-Reply-To: <200110290244.f9T2ihc04347@mass.dis.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
Mike Smith wrote:
> > Changing alpha isn't near as "bad" as changing i386, as it already passes a
    rg
> > s
> > in 64-bit registers, so printf won't break, etc.  I don't think i386 should
> > ever change, personally, but I don't think it will really break Alpha near 
    as
> > much as i386.
> 
> As with most folk, you forget pass-by-reference here.  8)

We had one of these in the ACPICA code recently. :-)

A pointer to int had been cast that hid the fact that it was a 32/64 bit
mismatch.  *NO* compiler warnings will detect that.

Specifically, it was:

int i;
int j;

bus_read_ivar(dev, .....,  (uintptr_t *)&i);

.. which was silently accepted by the compiler.  And 'i' was written as
a 'long' and consequently trashed the 'j' variable that was on the stack
right after it.  (uintptr_t is 64 bit on non-i386)

We risk the same problem in 3rd party apps.

Cheers,
-Peter
--
Peter Wemm - peter@FreeBSD.org; peter@yahoo-inc.com; peter@netplex.com.au
"All of this is for nothing if we don't go to the stars" - JMS/B5


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




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