Hi,

On Thu, Mar 28, 2013 at 08:46:59AM +0100, Alexander Dahl wrote:
> Am 2013-03-27 18:57, schrieb Michael Olbrich:
> > When does this issue happen anyways? I've never seen it.
> 
> The problem is in one of the test programs, code was like this before:
> 
>   uint16_t *tab_rp_registers;
>   /* load some data to this poiner */
>   *((uint32_t *)tab_rp_registers) = something_else;
> 
> On ARMv5 (which we use here) and older the CPU can not access memory
> bytewise, so fetching an 2 or 4 byte integer from an unaligned memory
> address leads to wrong data. Get a detailed explanation here:
> http://lecs.cs.ucla.edu/wiki/index.php/XScale_alignment
> 
> The cast from an *uint16_t to an *uint32_t could lead to such an
> unaligned access. You can let the compiler spot such things and warn you
> with -Wcast-align (which is btw not part of -Wall) and we set
> -Wcast-align globally to spot those things in our own code for ARMv5
> architecture.
> 
> The problem is with libmodbus3 setting -Werror which leads to all
> warnings be handled as errors and thus the failing build.

Ah, here is the missing link. I know the alignment issue, but I also know
that this usually doesn't generate build errors.

> In short: the combination of -Werror in libmodbus and -Wcast-align in
> our PTXCONF_TARGET_EXTRA_CFLAGS triggered this.
> 
> > But I like the change, because we compile less that way.
> 
> Someone who wants the test would have to edit the rules then, but she
> would need to edit the targetinstall rule then anyway.

True.

Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
[email protected]

Reply via email to