[Cbe-oss-dev] memalign weirdness in newlib

Paul Mackerras paulus at samba.org
Mon Dec 24 13:53:55 EST 2007


Michael Ellerman writes:

> [michael at schoenaich bug]$ elfspe memalign
> align = 0x10 p = 0x1c20 q = 0x2e20
> align = 0x20 p = 0x3e20 q = 0x4e60
> align = 0x30 p = 0x5ec0 q = 0x5ec0
> align = 0x40 p = 0x5ec0 q = 0x5ec0
> align = 0x50 p = 0x5ef0 q = 0x5ef0
> align = 0x60 p = 0x5f00 q = 0x5f00
> align = 0x70 p = 0x5f00 q = 0x5f00
> align = 0x80 p = 0x5f00 q = 0x5f00
> 
> For alignments > 0x20 successive calls to memalign() return the same
> memory? Or am I going crazy.

The alignment has to be a power of 2, so I imagine you're invoking
undefined behaviour for the 0x30, 0x50, 0x60 and 0x70 cases.

Paul.



More information about the cbe-oss-dev mailing list