http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45813
--- Comment #15 from Mikael Pettersson <mikpe at it dot uu.se> 2012-03-15 08:10:55 UTC --- -fno-strict-aliasing makes no difference to the code generated by 4.5-20120308. Replacing the type-punning with a union results in both correct-looking and much tighter code: unsigned short ReadLE16U_union( volatile unsigned char * ptr ) { union { unsigned short value; unsigned char bytes[2]; } u; u.bytes[0] = ptr[0]; u.bytes[1] = ptr[1]; return u.value; } ReadLE16U_union: push {r7, lr} ldrb r3, [r0] ldrb r0, [r0, #1] add r7, sp, #0 mov sp, r7 lsl r0, r0, #8 orr r0, r0, r3 @ sp needed for prologue pop {r7, pc} .size ReadLE16U_union, .-ReadLE16U_union .ident "GCC: (GNU) 4.5.4 20120308 (prerelease)"