[U-Boot-Users] mvbc_p board: build warnings

Wolfgang Denk wd at denx.de
Thu Jul 31 15:26:12 CEST 2008


Hi,

I'm trying to clean up the build warnings for the mvbc_p board.
I've succeded with all but this one:

mvbc_p.c: In function 'mvbc_init_gpio':
mvbc_p.c:124: warning: dereferencing type-punned pointer will break strict-aliasing rules

This relates to the following code:

115         out_be32(&gpio->simple_ddr, SIMPLE_DDR);
116         out_be32(&gpio->simple_dvo, SIMPLE_DVO);
117         out_be32(&gpio->simple_ode, SIMPLE_ODE);
118         out_be32(&gpio->simple_gpioe, SIMPLE_GPIOEN);	<== volatile u8 outo_gpioe;
119
120         out_be32((u32*)&gpio->sint_ode, SINT_ODE);		<== volatile u8 sint_ode;
121         out_be32((u32*)&gpio->sint_ddr, SINT_DDR);		<== volatile u8 sint_ddr;
122         out_be32((u32*)&gpio->sint_dvo, SINT_DVO);		<== volatile u8 sint_dvo;
123         out_be32((u32*)&gpio->sint_inten, SINT_INTEN);	<== volatile u8 sint_inten;
124         out_be32((u32*)&gpio->sint_itype, SINT_ITYPE);	<== volatile u16 sint_itype;
125         out_be32((u32*)&gpio->sint_gpioe, SINT_GPIOEN);	<== volatile u8 outo_gpioe;


I don't know why the warning is only issued for the  "u16"  type  and
not  also for the "u8" ones, but anyway: Is the casting to "u32*" and
using out_be32() here really correct?

I would expect to see some out_be8() and one out_be16() here?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"In Christianity neither morality nor religion come into contact with
reality at any point."                          - Friedrich Nietzsche




More information about the U-Boot mailing list