Comment 0 for bug 1909184

Revision history for this message
john (jkovach) wrote :

When compiling the following code:

int dst;
void func(unsigned short volatile* src)
{
  dst = *src;
}

with "gcc -mcpu=cortex-m3 -O2" I get an unnecessary UXTH:

ldrh r3, [r0]
ldr r2, .L3
uxth r3, r3
str r3, [r2]
bx lr

The problem does not manifest itself if I omit "volatile" or replace "-mcpu" with "cortex-m0".
See here: https://godbolt.org/z/K8Pjq7