[Bug middle-end/54386] Unaligned mem load wrongly generated for inlined inline/static function

olegendo at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Oct 29 20:38:00 GMT 2012


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

Oleg Endo <olegendo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|sh*-*-*                     |sh*-*-* arm*
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-10-29
     Ever Confirmed|0                           |1

--- Comment #3 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-10-29 20:38:08 UTC ---
I've checked this issue again on rev 192482.  It seems to be target
independent, as it also happens on ARM.
The following:

static inline int readint (int* x)
{
  return *x;
}

int test (int* x)
{
  return readint (x);
}

compiles to (-O2):

test:
        ldrb    r3, [r0]
    ldrb    r1, [r0, #1]
    ldrb    r2, [r0, #2]
    orr    r3, r3, r1, asl #8
    ldrb    r0, [r0, #3]
    orr    r3, r3, r2, asl #16
    orr    r0, r3, r0, asl #24
    bx    lr



More information about the Gcc-bugs mailing list