Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Sep 2007 02:19:33 +1000 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@des.no>
Cc:        cvs-all@FreeBSD.org, cvs-src@FreeBSD.org, src-committers@FreeBSD.org, Sean Farley <scf@FreeBSD.org>, Bruce Evans <brde@optusnet.com.au>
Subject:   Re: cvs commit: src/lib/libc/stdlib getenv.c
Message-ID:  <20070924012406.I50268@delplex.bde.org>
In-Reply-To: <86wsuhv70n.fsf@ds4.des.no>
References:  <200709220230.l8M2UiRK020609@repoman.freebsd.org> <86r6krqbrd.fsf@ds4.des.no> <20070922202914.B90809@besplex.bde.org> <86wsuhv70n.fsf@ds4.des.no>

next in thread | previous in thread | raw e-mail | index | archive | help
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--0-271979577-1190564373=:50268
Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE

On Sun, 23 Sep 2007, [utf-8] Dag-Erling Sm=C3=B8rgrav wrote:

> Bruce Evans <brde@optusnet.com.au> writes:
>> On Sat, 22 Sep 2007, [utf-8] Dag-Erling Sm=C3=B8rgrav wrote:
>>> s/to remove the warning/to actually work/
>> Please be precise :-).
>> s/to remove the warning ... on 64-bit platforms/to avoid undefined behav=
iour
>> on platforms where size_t is not u_int, and to avoid having to make a
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> delicate analysis to show that the behaviour is defined and correct on
>> all other platforms/.
>>
>> Delicate analysis:
>> ...

> you left out the case where size_t is larger than unsigned int, i.e. all
> 64-bit platforms.  Even if the stack is aligned to the size of size_t,
> you will get interesting results on a big-endian system.

Nope.  This is a trivial subcase of a case that I didn't leave out.
Platforms where size_t is not u_int includes all platforms where size_t
is larger than u_int spelled verbosely.  This is not all 64-bit
platforms, but some 64-bit platforms including all 64-bit platforms
supported by FreeBSD.

I think stack alignment gives uninteresting results in practice even
on big-endian systems, since the least significant bytes normally end
up in the place where a type pun will see them by going through a
register.  This is most obvious if they are passed in a register, which
can happen even for variadic args -- then endianness has no significant
effect.  I think lots of code still depends on the alignment to make
things sort of work.

Bruce
--0-271979577-1190564373=:50268--



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