http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58041

            Bug ID: 58041
           Summary: Unaligned access to arrays in packed structure
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bernd.edlinger at hotmail dot de

the attached test case shows unaligned accesses can be generated
on arm architecture, despite the -mno-unaligned-access option.
This does not happen at -O0 and -Og,
but it always happens at at -Os -O1 -O2 and -O3 to name a few.

assembler output for foo shows unaligned opcodes:

foo:
        @ Function supports interworking.
        @ args = 0, pretend = 0, frame = 0
        @ frame_needed = 0, uses_anonymous_args = 0
        @ link register save eliminated.
        add     ip, r0, r1, asl #3
        add     r1, ip, #1
        ldmia   r1, {r0-r1}
        str     r2, [ip, #1]
        str     r3, [ip, #5]
        bx      lr

reproduced with latest trunk:

  $ ../gcc-4.9-20130728/configure --target=arm-eabi
--prefix=/home/ed/gnu/arm-eabi --with-newlib --enable-languages=c,c++
--disable-hosted-libstdcxx --disable-__cxa_atexit

Reply via email to