recent current kernel compile failure
Stefan Farfeleder
stefan at fafoe.narf.at
Thu Jan 27 05:54:59 PST 2005
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
More information about the freebsd-current
mailing list