https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65459
Bug ID: 65459 Summary: munaligned-access still produce split access codes Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: ma.jiang at zte dot com.cn Hi all, The munaligned-access option on ARM can not stop gcc from producing split access codes. A very simple test char mt[20]; void main() { void *mm=&(mt[1]); *(( int *)mm)=4; } compiled with -O2 -munaligned-access could reproduce this problem.As we can see,"*(( int *)mm)=4;" cause gcc to emit 4 strb instructions not a unaligned stw . In my opinion, this bug is caused by the SLOW_UNALIGNED_ACCESS macro,which is defined to be 1 in arm.h. It is very strange that the munaligned-access option can affect neither SLOW_UNALIGNED_ACCESS nor STRICT_ALIGNMENT. On PPC,the mstrict-align can affect STRICT_ALIGNMENT, and SLOW_UNALIGNED_ACCESS is determined by STRICT_ALIGNMENT, ALIGN, and MODE(args of the SLOW_UNALIGNED_ACCESS macro). This is a good example for ARM, I think.