http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49094
Søren Holm <sgh at sgh dot dk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |sgh at sgh dot dk --- Comment #11 from Søren Holm <sgh at sgh dot dk> 2011-07-30 12:13:56 UTC --- tst2.c also fails with an alignment related problem. I'm unsue if this should be reported in another bug. With "static" on line 33 the code generated is this : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< unsigned int aostk_font_strwidth(const struct aostk_font* font, const char* str) { const struct aostk_glyph* g = aostk_get_glyph(font, 0); return g->advance.x; 0: e5903003 ldr r3, [r0, #3] } 4: e5d30005 ldrb r0, [r3, #5] 8: e12fff1e bx lr >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> The first ldr-instruction is wrong afaik sinct struct aostk_font is packed. Removing "static" fomr line 33 gives this code : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< const struct aostk_glyph* aostk_get_glyph(const struct aostk_font* f, unsigned int c) { return &f->glyphs[0]; 0: e5d02004 ldrb r2, [r0, #4] 4: e5d03003 ldrb r3, [r0, #3] 8: e1833402 orr r3, r3, r2, lsl #8 c: e5d02005 ldrb r2, [r0, #5] 10: e5d00006 ldrb r0, [r0, #6] 14: e1833802 orr r3, r3, r2, lsl #16 } 18: e1830c00 orr r0, r3, r0, lsl #24 1c: e12fff1e bx lr 00000020 <aostk_font_strwidth>: const struct aostk_glyph* glyphs; }; const struct aostk_glyph* aostk_get_glyph(const struct aostk_font* f, unsigned int c) { return &f->glyphs[0]; 20: e5d02004 ldrb r2, [r0, #4] 24: e5d03003 ldrb r3, [r0, #3] 28: e1833402 orr r3, r3, r2, lsl #8 2c: e5d02005 ldrb r2, [r0, #5] 30: e1833802 orr r3, r3, r2, lsl #16 34: e5d02006 ldrb r2, [r0, #6] 38: e1833c02 orr r3, r3, r2, lsl #24 unsigned int aostk_font_strwidth(const struct aostk_font* font, const char* str) { const struct aostk_glyph* g = aostk_get_glyph(font, 0); return g->advance.x; } 3c: e5d30005 ldrb r0, [r3, #5] 40: e12fff1e bx lr >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Notice in aostk_get_glyph that the ldrb-instructions are used instead of ldr.