This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/16491] New: Unaligned accesses broken on ppc64


struct __attribute__((packed)) G { unsigned char i; unsigned long l; };
unsigned long
foo (struct G x)
{
  return x.l;
}

fails to compile at -O1 and higher.
e.c: In function `foo':
e.c:6: error: insn does not satisfy its constraints:
(insn:HI 24 33 27 0 (set (reg/i:DI 3 3 [ <result> ])
        (mem/s:DI (plus:DI (reg:DI 9 9)
                (const_int 49 [0x31])) [4 x.l+0 S8 A8])) 326 {*movdi_internal64}
(insn_list 7 (insn_list 8 (nil)))
    (nil))
e.c:6: internal compiler error: in reload_cse_simplify_operands, at
postreload.c:378

This was fixed for 3.4 with PR rtl-optimization/13674 patch.
For this testcase though, -fnew-ra doesn't help at all.

ppc64 doesn't have STRICT_ALIGNMENT != 0 (unless -fstrict-align, but that fixes
the testcase), so I don't see how movdi_internal64 insn can refuse to handle
non-aligned loads.  SLOW_UNALIGNED_ACCESS will handle most of the cases by doing
the load in pieces, but that still doesn't mean such instructions can't be
generated.

-- 
           Summary: Unaligned accesses broken on ppc64
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: powerpc64-redhat-linux


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]