From owner-freebsd-current@FreeBSD.ORG Wed Feb 26 21:20:29 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CA22CD2F; Wed, 26 Feb 2014 21:20:29 +0000 (UTC) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 87D451D37; Wed, 26 Feb 2014 21:20:29 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id s1QLKHES040992 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 26 Feb 2014 13:20:18 -0800 (PST) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id s1QLKHep040991; Wed, 26 Feb 2014 13:20:17 -0800 (PST) (envelope-from jmg) Date: Wed, 26 Feb 2014 13:20:17 -0800 From: John-Mark Gurney To: Justin Hibbits Subject: Re: Build failure on PowerPC in pf Message-ID: <20140226212017.GY92037@funkthat.com> Mail-Followup-To: Justin Hibbits , FreeBSD Current , glebius@FreeBSD.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Wed, 26 Feb 2014 13:20:18 -0800 (PST) Cc: FreeBSD Current , glebius@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Feb 2014 21:20:29 -0000 Justin Hibbits wrote this message on Wed, Feb 26, 2014 at 11:12 -0800: > On Wed, Feb 26, 2014 at 10:32 AM, Justin Hibbits wrote: > > Building on PowerPC I see the following failure: > > > > cc1: warnings being treated as errors > > > > /home/chmeee/freebsd/head/sys/modules/pf/../../netpfil/pf/pf_ioctl.c: > > In function 'pfioctl': > > /home/chmeee/freebsd/head/sys/modules/pf/../../netpfil/pf/pf_ioctl.c:1357:warning: > > cast to pointer from integer of different size [-Wint-to-pointer-cast] > > /home/chmeee/freebsd/head/sys/modules/pf/../../netpfil/pf/pf_ioctl.c:1359:warning: > > cast to pointer from integer of different size [-Wint-to-pointer-cast] > > /home/chmeee/freebsd/head/sys/modules/pf/../../netpfil/pf/pf_ioctl.c:1361:warning: > > cast to pointer from integer of different size [-Wint-to-pointer-cast] > > > > struct pf_rule has counter_u64_t entries, which are actually pointers > > to uint64_t's. These pointers get assigned from the result of > > counter_u64_fetch(), which returns a uint64_t. Looks to me like > > there's a bug in here, but I have no idea what to do to fix it. And > > I'm surprised this hasn't been reported against other 32-bit > > architectures. > > Replying to myself, it looks like this was broken by r261882. This comment says it all: 1352 glebius 261882 /* 1353 * XXXGL: this is what happens when internal kernel 1354 * structures are used as ioctl API structures. 1355 */ So, one way could be to use a union for the states: union { struct { counter_u64_t states_cur; counter_u64_t states_tot; counter_u64_t src_nodes; } k; struct { uint64_t states_cur; uint64_t states_tot; uint64_t src_nodes; } u; } u; The other option is to cast through uintptr_t... Even though it'd make the code a bit more ugly, I'd vote for the union, since it's designed for what the code is trying to do... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."