On Wed, Feb 26, 2014 at 1:20 PM, John-Mark Gurney <jmg_at_funkthat.com> wrote: > 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 <jrh29_at_alumni.cwru.edu> 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." Casting through uintptr_t eliminated the warning. But, like you said, the union is the better way to go. - JustinReceived on Wed Feb 26 2014 - 21:01:57 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:47 UTC