Date: Thu, 27 Jan 2005 14:54:53 +0100 From: Stefan Farfeleder <stefan@fafoe.narf.at> To: Scott Long <scottl@samsco.org> Cc: current@freebsd.org Subject: Re: recent current kernel compile failure Message-ID: <20050127135452.GU21084@wombat.fafoe.narf.at> In-Reply-To: <41F8D54F.9090802@samsco.org> References: <20050127113906.GA98285@stud.fit.vutbr.cz> <41F8D54F.9090802@samsco.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jan 27, 2005 at 04:49:35AM -0700, Scott Long wrote: > Divacky Roman wrote: > > >hi > > > >recent current with CFLAGS=-O2: > > > >../dev/amr/amr_pci.c > >/usr/src/sys/modules/amr/../../dev/amr/amr_pci.c: In function > >`amr_setup_mbox': > >/usr/src/sys/modules/amr/../../dev/amr/amr_pci.c:605: warning: > >dereferencing > >type-punned pointer will break strict-aliasing rules > > > >would be nice to have this repaired > > > >roman > > We don't support compiling with -fstrict-aliasing. The correct solution > is likely to change the type of 'p' and add a bunch of casts. Not very > pretty, but I guess no worse than the horribly non-informative gcc > message that is generated here. This patch should be better: Index: amr_pci.c =================================================================== RCS file: /b/ncvs/src/sys/dev/amr/amr_pci.c,v retrieving revision 1.27 diff -I.svn -u -r1.27 amr_pci.c --- amr_pci.c 23 Jan 2005 23:25:41 -0000 1.27 +++ amr_pci.c 27 Jan 2005 13:51:27 -0000 @@ -574,7 +574,7 @@ amr_setup_mbox(struct amr_softc *sc) { int error; - u_int8_t *p; + void *p; debug_called(1); @@ -602,7 +602,7 @@ * Allocate the mailbox structure and permanently map it into * controller-visible space. */ - error = bus_dmamem_alloc(sc->amr_mailbox_dmat, (void **)&p, BUS_DMA_NOWAIT, + error = bus_dmamem_alloc(sc->amr_mailbox_dmat, &p, BUS_DMA_NOWAIT, &sc->amr_mailbox_dmamap); if (error) { device_printf(sc->amr_dev, "can't allocate mailbox memory\n"); @@ -614,8 +614,8 @@ * Conventional mailbox is inside the mailbox64 region. */ bzero(p, sizeof(struct amr_mailbox64)); - sc->amr_mailbox64 = (struct amr_mailbox64 *)(p + 12); - sc->amr_mailbox = (struct amr_mailbox *)(p + 16); + sc->amr_mailbox64 = (struct amr_mailbox64 *)((char *)p + 12); + sc->amr_mailbox = (struct amr_mailbox *)((char *)p + 16); return(0); } Stefan
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050127135452.GU21084>