https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89746
Bug ID: 89746 Summary: powerpc-none-eabi-gcc emits code using stfiwx to misaligned address Product: gcc Version: 8.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: davem at devkitpro dot org Target Milestone: --- The following code produces an alignment exception on powerpc 750 and I presume on other powerpc ISAs where unaligned floating point is not allowed. typedef struct { int i; short x, y, z; } foo; void bar(foo *p, float f) { int d = f; p->y = d>>16; p->z = d&0xFFFF; } file "stfiwx-test.c" .section ".text" .align 2 .globl bar .type bar, @function bar: .LFB0: .cfi_startproc fctiwz %f1,%f1 addi %r3,%r3,6 stfiwx %f1,0,%r3 blr .cfi_endproc .LFE0: .size bar, .-bar compiling with -mstrict-align generates working code .file "stfiwx-test.c" .section ".text" .align 2 .globl bar .type bar, @function bar: .LFB0: .cfi_startproc stwu %r1,-16(%r1) .cfi_def_cfa_offset 16 fctiwz %f1,%f1 addi %r9,%r1,8 stfiwx %f1,0,%r9 lwz %r9,8(%r1) srawi %r10,%r9,16 sth %r9,8(%r3) sth %r10,6(%r3) addi %r1,%r1,16 .cfi_def_cfa_offset 0 blr .cfi_endproc .LFE0: .size bar, .-bar