From owner-freebsd-net@FreeBSD.ORG Tue Mar 16 15:34:54 2004 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 31CB516A4CE; Tue, 16 Mar 2004 15:34:54 -0800 (PST) Received: from smtp.des.no (flood.des.no [217.116.83.31]) by mx1.FreeBSD.org (Postfix) with ESMTP id DFE7043D3F; Tue, 16 Mar 2004 15:34:53 -0800 (PST) (envelope-from des@des.no) Received: by smtp.des.no (Pony Express, from userid 666) id 0078D530E; Wed, 17 Mar 2004 00:34:52 +0100 (CET) Received: from dwp.des.no (des.no [80.203.228.37]) by smtp.des.no (Pony Express) with ESMTP id E1E28530A; Wed, 17 Mar 2004 00:34:46 +0100 (CET) Received: by dwp.des.no (Postfix, from userid 2602) id 65A1C33C6B; Wed, 17 Mar 2004 00:34:46 +0100 (CET) To: Ruslan Ermilov References: <20040316225230.GO3462@ip.net.ua> <20040316232848.GR3462@ip.net.ua> From: des@des.no (Dag-Erling =?iso-8859-1?q?Sm=F8rgrav?=) Date: Wed, 17 Mar 2004 00:34:46 +0100 In-Reply-To: <20040316232848.GR3462@ip.net.ua> (Ruslan Ermilov's message of "Wed, 17 Mar 2004 01:28:48 +0200") Message-ID: User-Agent: Gnus/5.090024 (Oort Gnus v0.24) Emacs/21.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on flood.des.no X-Spam-Level: X-Spam-Status: No, hits=0.0 required=5.0 tests=AWL autolearn=no version=2.63 cc: current@freebsd.org cc: net@freebsd.org Subject: Re: libalias patch for review / testing X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2004 23:34:54 -0000 Ruslan Ermilov 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