Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Mar 2004 00:34:46 +0100
From:      des@des.no (Dag-Erling =?iso-8859-1?q?Sm=F8rgrav?=)
To:        Ruslan Ermilov <ru@freebsd.org>
Cc:        net@freebsd.org
Subject:   Re: libalias patch for review / testing
Message-ID:  <xzpn06ggycp.fsf@dwp.des.no>
In-Reply-To: <20040316232848.GR3462@ip.net.ua> (Ruslan Ermilov's message of "Wed, 17 Mar 2004 01:28:48 %2B0200")
References:  <xzp7jxkjv98.fsf@dwp.des.no> <xzp3c88jv7k.fsf@dwp.des.no> <20040316225230.GO3462@ip.net.ua> <xzpllm0ie5z.fsf@dwp.des.no> <20040316232848.GR3462@ip.net.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
Ruslan Ermilov <ru@freebsd.org> writes:
> : `-fstrict-aliasing'
> :      Allows the compiler to assume the strictest aliasing rules
> :      applicable to the language being compiled.  For C (and C++), this
> :      activates optimizations based on the type of expressions.  In
> :      particular, an object of one type is assumed never to reside at
> :      the same address as an object of a different type, unless the
> :      types are almost the same.  For example, an `unsigned int' can
> :      alias an `int', but not a `void*' or a `double'.  A character type
> :      may alias any other type.
>
> And asking myself a question: should those (void *)'s in your patch
> be (char *)'s instead, e.g., in twowords() and DifferentialChecksum(),
> or am I misreading the above?

You're misreading, we're doing u_short * <-> void * (both pointers)
but the man page speaks about int <-> void * (scalar vs pointer)

Also, I doubt DifferentialChecksum() is a problem, since it's a
function call.  I think the problem may be in the code I've replaced
with calls to twowords().

> Also, the easiest way to check if strict aliasing is guilty for not
> working libalias compiled with -O2, is to compile the original code
> with -O2 -fno-strict-aliasing.

True, I didn't think of that.

DES
--=20
Dag-Erling Sm=C3=B8rgrav - des@des.no



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